【Rust日报】2021-09-10 Rust 1.55 稳定版发布

Rust 1.55 稳定版发布

Rust 1.55 是 2021 Edition 正式发布之前的倒数第二个版本,此版本主要更新如下:

  • range 操作符支持半开语法

match x as u32 {
      0 => println!("zero!"),
      1.. => println!("positive number!"),
}

  • 极大的提高浮点数的解析速度

采用新的 Eisel-Lemire 算法解析浮点数,不仅在速度上有很大提升,之前一些解析失败的边缘 case 也全都修复了

  • cargo 构建的时候不再重复报 Error

  • 细化 io::ErrorKind

使用 ErrorKind::Other 来区分标准库之外产生的 io Error,标准库之内不会再产生 ErrorKind::Other 的 Error。标准库未来暂未分类的 Error 类型,统一使用 Uncategorized。

  • 数组增加 map() 方法

数组的 map() 方法返回的依然是数组,对数组来说更方便!

  • 稳定 ops::ControlFlow

这是未来要稳定的 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/627886036211900416

Rustaceans 准则

Niko 发布了一篇博客,总结出 Rustaceans 的准则,比如其中提到:

Rust empowers by being…

  • ⚙️ 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”

How to Rustacean

  • ???? Be kind and considerate

  • ✨ Bring joy to the user

  • ???? Show up

  • ???? Recognize others’ knowledge

  • ???? Start somewhere

  • ✅ Follow through

  • ???? Pay it forward

  • ???? Trust and delegate

链接:https://smallcultfollowing.com/babysteps//blog/2021/09/08/rustacean-principles/

-- From 日报小组 Folyd, 侯盛鑫

社区学习交流平台订阅:

  • Rustcc论坛: 支持rss

  • 微信公众号:Rust语言中文社区

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值