cargo

Rust 项目与依赖管理工具

补充说明

cargo 是 Rust 的标准构建系统和包管理器,负责创建项目、解析依赖、编译、测试和发布。它调用 rustc,但补齐了依赖、特性和工作区管理。

常用示例

cargo new app
cargo init
cargo build
cargo build --release
cargo run -- arg1
cargo test
cargo test -- --nocapture
cargo check
cargo clippy --all-targets --all-features
cargo fmt --check
cargo add serde --features derive
cargo update
cargo tree
cargo doc --open
cargo install ripgrep
cargo clean

易错点与排错

相关命令