rust速通
rust速通
基本使用
使用编译器rustc
1
rustc main.rs
使用包管理器cargo
1
2
# 创建项目
cargo new hello_cargo
1
2
3
4
5
6
7
8
9
10
11
# 检查代码确保可以编译,不产生可执行文件,比build要快
cargo check
# 编译
cargo build
# 编译并运行
cargo run
# 准备发布,优化编译项目
cargo build --release
使用 Cargo 的一个额外的优点是,不管你使用什么操作系统,其命令都是一样的
This post is licensed under CC BY 4.0 by the author.