安装
https://www.rust-lang.org/zh-CN/tools/install
2
x86_64-pc-windows-gnu
rustc --version
rustc -V
cargo -V
常用命令
#rust更新
rustup update
#rust卸载
rustup self uninstall
#rust版本
rustc --version
#rust文档
rust doc
#格式化文件
#vscode格式化快捷键
#Shift+Alt+F
rustfmt main.rs
cargo --version
cargo -V
#升级Cargo.toml依赖包
cargo update
hello
rustc编译
hello_world
//main.rs
fn main() {
println!("Hello, world!");
}
mkdir hello_world
cd hello_world
//edit main.rs
rustc main.rs
main.exe
cargo编译
hello_cargo
cargo new hello_cargo
cd hello_cargo
cargo build
cargo run
cargo check
cargo build --release
cargo run --release