Rust 编程语言 - 安装
阅读Rust程序设计语言笔记
安装
- 下载rustup脚本,并安装
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
- 或者直接brew install rust安装
- 通过 rustc --verison查看是否成功
|  |  | 
hello world
|  |  | 
执行 rustc main.rs 编译,./main执行; 可以通过rustfmt 格式化代码
Cargo
rust 的构建系统和包管理器。
- cargo 创建项目 cargo new hello; 会生成 Cargo.toml 以及一个src/main.rs
|  |  | 
- 编译 cargo build; 二次编译会缓存,不需要重新编译
- 直接运行 cargo run
- 静态检查 cargo check; 检查是否可编译通过
- 发布 cargo build --release; 会做编译优化
@2023-01-31
