0
点赞
收藏
分享

微信扫一扫

Rust 1.39 正式发布

Rust 1.39 今天 正式发布。来看看有哪些特性稳定了。


async/await


万众瞩目的 async/await 稳定了。async fn/async {}/ async move {} 都是可以的。


match 条件守卫中中更流畅的写法


对于被 move 的值,可以在 match 条件守卫中引用了。


函数参数上施加属性



#[cfg(windows)]fn len(slice: &[u16]) -> usize {
slice.len()
}
#[cfg(not(windows))]
fn len(slice: &[u8]) -> usize {
slice.len()


}


现在可以这么写了


fn len(
#[cfg(windows)] slice: &[u16], // This parameter is used on Windows.
#[cfg(not(windows))] slice: &[u8], // Elsewhere, this one is used.
) -> usize {
slice.len()
}

等,其它。完整版,请直接查看:

​​https://blog.rust-lang.org/2019/11/07/Rust-1.39.0.html​​


举报

相关推荐

0 条评论