-
StackOverflow 文件
-
Rust 教程
-
鏽風格指南
-
型別
輸入註釋
// There should be one space after the colon of the type
// annotation. This rule applies in variable declarations,
// struct fields, functions and methods.
// GOOD:
let mut buffer: String = String::new();
// BAD:
let mut buffer:String = String::new();
let mut buffer : String = String::new();
參考
// The ampersand (&) of a reference should be 'touching'
// the type it refers to.
// GOOD:
let x: &str = "Hello, world.";
// BAD:
fn fooify(x: & str) {
println!("{}", x);
}
// Mutable references should be formatted like so:
fn bar(buf: &mut String) {
}