Rust
Project Commands
Create and manage Rust projects with Cargo. Initialize new libraries and binaries, configure Cargo.toml, and organize your project structure for scalable development.
7 commands
Pro Tips
Use 'cargo new --lib mylib' for libraries and 'cargo new myapp' for binaries — sets up the correct template.
Use workspace Cargo.toml for monorepos: '[workspace] members = ["crates/*"]' shares dependencies.
Add '[profile.dev] opt-level = 1' to Cargo.toml for faster debug builds with some optimization.
Common Mistakes
Cargo.lock should be committed for binaries but NOT for libraries. Libraries should be flexible on versions.
Changing crate names in Cargo.toml after publishing can break downstream users. Plan names carefully.