Rust 1.8 發布,增加新特性

Rust 1.8 發布了。Rust 是 Mozilla 的一個新的編程語言,由web語言的領軍人物Brendan Eich(js之父),Dave Herman以及Mozilla公司的Graydon Hoare 合力開發。
和往常一樣,你可以從我們的官方頁面安裝Rust 1.8 ,你也可以在Github上查看詳細的更新說明 。
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 initcan be used to start a Cargo project in your current working directory, rather than making a new subdirectory likecargo new. -
cargo metadatais another new subcommand for fetching metadata about a project. -
.cargo/confignow has keys for-vand--color -
Cargo’s ability to have target-specific dependencies was enhanced.
這次更新最值得關注的是,Rust 放棄了 Unix 系統傳統的 Make 工具,使用 Rust 自己的 Cargo 包管理工具。
詳情查看發行說明
來源:oschina