Rust 1.55 稳定版发布
Rust 1.55 是 2021 Edition 正式发布之前的倒数第二个版本,此版本主要更新如下:
match x as u32 {
0 => println!("zero!"),
1.. => println!("positive number!"),
}
采用新的 Eisel-Lemire 算法解析浮点数,不仅在速度上有很大提升,之前一些解析失败的边缘 case 也全都修复了
使用 ErrorKind::Other 来区分标准库之外产生的 io Error,标准库之内不会再产生 ErrorKind::Other 的 Error。标准库未来暂未分类的 Error 类型,统一使用 Uncategorized。
数组的 map() 方法返回的依然是数组,对数组来说更方便!
这是未来要稳定的 try trait v2 的一部分。pub enum ControlFlow<B, C = ()> {
Continue(C),
Break(B),
}
cargo clippy --fix 可以自动帮你修复 clippy 的警告
链接:https://blog.rust-lang.org/2021/09/09/Rust-1.55.0.html纪念 Anna Harren
Anna Harren 是第一个将 Rust 的 ::<> 语法命名为 Turbofish 的人。Rust 官方发布 1.55 的时候在博客里还特意纪念了最近刚去世的 Anna Harren。链接:https://twitter.com/garblefart/status/627886036211900416Rustaceans 准则
Niko 发布了一篇博客,总结出 Rustaceans 的准则,比如其中提到:
- ⚙️ Reliable: “if it compiles, it works”
- 🐎 Performant: “idiomatic code runs efficiently”
- 🥰 Supportive: “the language, tools, and community are here to help”
- 🧩 Productive: “a little effort does a lot of work”
- 🔧 Transparent: “you can predict and control low-level details”
- 🤸 Versatile: “you can do anything with Rust”
- 💖 Be kind and considerate
- 🔭 Recognize others’ knowledge
链接:https://smallcultfollowing.com/babysteps//blog/2021/09/08/rustacean-principles/
原文作者:Rust语言中文社区;如有侵权,请联系管理员删除。