Rust 1.8 发布了。Rust 是 Mozilla 的一个新的编程语言,由web语言的领军人物Brendan Eich(js之父),Dave Herman以及Mozilla公司的Graydon Hoare 合力开发。
Rust 1.8有两个新功能,并有针对Windows用户的好消息。
第一个新特征是各式各样的“operator equals”运算符,如+ =和 - =,现在正通过各种性状重载。这一变化在RFC953,看起来就像这样:
use std::ops::AddAssign;
#[derive(Debug)]
struct Count {
value: i32,
}
impl AddAssign for Count {
fn add_assign(&mut self, other: Count) {
self.value += other.value;
}
}
fn main() {
let mut c1 = Count { value: 1 };
let c2 = Count { value: 5 };
c1 += c2;
println!("{:?}", c1);
第二个特性是非常小的,RFC 218,在Rust1.8之前,没有字段的结构没有大括号:
struct Foo; // works
struct Bar { } // error
在Windows方面,32位MSVC现在建立实施unwinding。这将移动i686-PC-Windows-MSVC到Tier 1的平台。
最后,我们长期使用 make 构建 Rust,但是,我们已经有了建立Rust项目的一个奇妙的工具: Cargo。
stabilizations 库
Rust已稳定拥有约20个库函数和方法,有三大主要变化:UTF-16 related string methods,various APIs related to time,various traits needed for operator overloading mentioned in the language section。
Cargo 特性
cargo init can be used to start a Cargo project in your current working directory, rather than making a new subdirectory like cargo new.
cargo metadata is another new subcommand for fetching metadata about a project.
.cargo/config now has keys for -v and --color
Cargo’s ability to have target-specific dependencies was enhanced.
软件详情:https://github.com/rust-lang/rust/blob/stable/RELEASES.md#version-180-2016-04-14
下载地址:https://www.rust-lang.org/install.html
来自:开源中国社区

