2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-15 06:12:59 +00:00
cheat.sheets/sheets/cargo
2019-08-06 08:28:53 -05:00

31 lines
807 B
Plaintext

# Cargo is the Rust package manager
# Cargo downloads your Rust project's dependencies,
# compiles your project, makes packages, and upload them to crates.io
# See also: https://doc.rust-lang.org/cargo/
# To start a new project
cargo new hello_world --bin # program
cargo new hello_world --lib # library
# Build a project without optimizations (in debug mode)
cargo build
# Build a project with optimizations turned on
cargo build --release
# Build and run (without optimizations) a package with Cargo
cargo run
# Updates dependencies in Cargo.lock
cargo update # update all
cargo update -p rand # updates just “rand” crate
# run the project tests (from src/ and tests/)
cargo test
# Clean all output build files and targets
cargo clean
# search for a package
cargo search