目錄
如果變數名稱跟 struct 欄位一樣的話可以簡化:
struct Point {
x: i32,
y: i32,
}
let x = 5;
let y = 6;
// old
let p = Point {
x: x,
y: y,
};
// new
let p = Point {
x,
y,
};
rustup target add x86_64-unknown-linux-musl
cargo build --target x86_64-unknown-linux-musl