< 返回版块

苦瓜小仔 发表于 2025-06-17 10:11

Tags:日报

公告:2025 年 Rust 编译器性能调查问卷

Rust团队启动了一项关于Rust编译器性能的调查。

编译时间长一直是影响Rust开发者生产力的主要问题之一。

此次调查专注于编译性能,旨在收集比年度“Rust现状”调查更详细的数据,以确定改进的重点。

调查预计耗时10分钟,完全匿名,截止日期为2025年7月7日。

结果将发布在Rust博客上,以帮助改进Rust的编译性能。

问卷:https://www.surveyhero.com/c/rust-compiler-performance-2025

阅读:https://blog.rust-lang.org/2025/06/16/rust-compiler-performance-survey-2025/

Reddit:https://www.reddit.com/r/rust/comments/1lcskhg/rust_compiler_performance_survey_2025_rust_blog/

Slint 1.12 发布:支持 WGPU(可与 Bevy 配合使用)、iOS 端口和 Figma Variables 集成

Slint 1.12 发布,带来多项重大更新。

  • 新增对 WGPU 的支持,可嵌入 Bevy 等 3D 渲染库
  • 首次支持 iOS,支持 Xcode 部署、原生字体渲染,并计划加入 Python 支持
  • 新增 Figma Variables 集成,可直接将 Figma 设计令牌导入应用,确保设计一致性
  • 改进了工具链,包括智能颜色选择器、实时预览的调试控制台等

Screenshot of the Bevy Demo

阅读:https://slint.dev/blog/slint-1.12-released

Reddit:https://www.reddit.com/r/rust/comments/1lctp0s/gui_toolkit_slint_112_released_with_wgpu_support/

primitive_fixed_point_decimal:真正的 fixed-point decimal 库

primitive_fixed_point_decimal 是一个 Rust 库,提供固定小数点的十进制类型,解决 Rust 内置浮点数无法精确表示十进制数和无法保证小数精度的问题。

它通过整数类型和缩放因子实现精度,且将缩放因子绑定到类型上,保证小数精度。

它提供 ConstScaleFpdecOobScaleFpdec 两种类型,分别用于静态指定和动态管理缩放因子。

仓库:https://github.com/WuBingzheng/primitive_fixed_point_decimal

Reddit:https://www.reddit.com/r/rust/comments/1lclryg/a_real_fixedpoint_decimal_crate/

rustcc 帖子:https://rustcc.cn/article?id=2f322fc0-13ba-45c7-a9da-0c3306161942

serde_json_borrow 0.8 - 性能超过 SIMD 的 JSON 解析器

serde_json_borrow 0.8 发布,性能大幅提升,成为最快的 JSON 解析器,甚至超过 simd_json

该版本通过引入自定义 Cow 包装器,允许借用对象键,优化了性能。

它提供 Value<'ctx>OwnedValue 两种方式处理 JSON 数据,前者直接从输入缓冲区借用数据,后者克隆数据。

默认启用的 cowkeys 特性支持转义字符串。

阅读:https://flexineering.com/posts/serde-json-borrow-08/

仓库:https://github.com/PSeitz/serde_json_borrow

Reddit:https://www.reddit.com/r/rust/comments/1ld59wt/serde_json_borrow_08_faster_json_deserialization/

Safe-math:安全地编写普通数学表达式(溢出检查,无 panic)

safe-math 是一个 Rust 库,通过 #[safe_math] 宏自动将标准算术运算转换为安全的检查运算,防止溢出和下溢。

它支持基本运算,提供简单宏 API,使用时只需在函数上标注即可。

#[safe_math]
fn add(a: u8, b: u8) -> Result<u8, ()> {
    Ok(a + b)
}

// 展开👇
fn add(a: u8, b: u8) -> Result<u8, ()> {
    Ok(safe_math::safe_add(a, b)?)
}

// 其中
fn safe_add(self, rhs: Self) -> Result<Self, ()> {
    self.checked_add(rhs).ok_or(())
}

仓库:https://github.com/GotenJBZ/safe-math-rs

Reddit:https://www.reddit.com/r/rust/comments/1lce5hb/safemathrs_write_normal_math_expressions_in_rust/

HeadlessPiPlayer:RaspberryPi 无头视频播放器

基于 Raspberry Pi,我用 Rust 开发了一个程序,支持通过 USB 闪存或 Web 服务器上传视频,并可通过 USB 设置 WiFi 配置。

程序采用 <FileSubscriber> --- <FilesManager/Sink> --- <Multiple: FileSource-s> 架构,支持多种文件来源,但仍有改进空间,例如统一文件来源信息和优化文件管理逻辑。

仓库:https://github.com/Gieneq/HeadlessPiPlayer

Reddit:https://www.reddit.com/r/rust/comments/1lcph3h/raspberrypi_headless_video_player_for_cosplay/

讨论:Rust 是否适合在某些场景下替代 Shell 脚本?

高赞回答:

“Python 更适合这样的角色。”

“可以试试 Nushell。它非常适合编写脚本,功能强大,而且是用 Rust 编写的。”

--

From 日报小组 苦瓜小仔

社区学习交流平台订阅:

评论区

写评论

还没有评论

1 共 0 条评论, 1 页