红联Linux门户
Linux帮助

Rust 1.19发布,Mozilla开发的系统编程语言

发布时间:2017-07-21 09:06:45来源:红联作者:baihuo
Rust 1.19.0 带来了一些期待已久的功能。Windows 用户要注意,Rust 依赖于 link.exe 来进行链接,可通过 Microsoft Visual C++ 构建工具获得。不过在最近发布的 Visual Studio 2017 中,这些工具的目录结构已更改,因此,要使用 Rust,需要使用 2015 的工具或使用变通方案(例如运行 vcvars.bat)。在 1.19.0 中,rustc 知道如何找到 2017 的工具,所以升级到 1.9.0 不需要使用变通方案。

新功能介绍:

Rust 1.19.0 首个支持 unions 的版本:[code]union MyUnion {
f1: u32,
f2: f32,
}[/code]Unions 与枚举有点类似,但 Unions 是“untagged”的。

除此之外,loops can now break with a value[code]// old code
let x;

loop {
x = 7;
break;
}

// new code
let x = loop { break 7; };[/code]Rust 将自己定位为“面向表达式的语言”,新的版本中,循环使用了这样的方式。

其他新特性

String now implements FromIterator> and Extend>

Vec now implements From<&mut [T]>

Box<[u8]> now implements From>

SplitWhitespace now implements Clone

软件详情:https://blog.rust-lang.org/2017/07/20/Rust-1.19.html

下载地址:https://www.rust-lang.org/en-US/install.html

来自:开源中国社区
文章评论

共有 0 条评论