# 二.cargo

  • 安装cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust.sh
1

rust 使用cargo

https://crates.io/crates/rand (opens new window)

  • 安装依赖
cargo add rand
1
  • 运行项目
cargo run
1
rust up
1
  • Cargo.toml

同时存在多个项目文件

members = ["*"]
1
  • 手动添加依赖,安装依赖
cargo update
1
  • 打开本地文档
cargo doc --open
1