Tweak comments in Cargo sheet, add more frequently used commands
- New comment style avoids incorrect syntax highlightingpull/113/head
parent
42ea6fd3e5
commit
fcf7085d22
@ -1,30 +1,43 @@
|
|||||||
# Cargo is the Rust package manager
|
// Cargo is the Rust package manager. It downloads your Rust project's dependencies,
|
||||||
# Cargo downloads your Rust project's dependencies,
|
// compiles your project, creates packages, and uploads them to crates.io.
|
||||||
# compiles your project, makes packages, and upload them to crates.io
|
// See also: https://doc.rust-lang.org/cargo/
|
||||||
# See also: https://doc.rust-lang.org/cargo/
|
|
||||||
|
|
||||||
# To start a new project
|
// To create a blank application:
|
||||||
cargo new hello_world --bin # program
|
cargo new hello_world // or cargo new --bin hello_world
|
||||||
cargo new hello_world --lib # library
|
|
||||||
|
|
||||||
# Build a project without optimizations (in debug mode)
|
// To create a blank library:
|
||||||
|
cargo new --lib hello_world
|
||||||
|
|
||||||
|
// Build a project without optimizations (in debug mode).
|
||||||
cargo build
|
cargo build
|
||||||
|
|
||||||
# Build a project with optimizations turned on
|
// Compile and check a project for errors (faster than cargo build)
|
||||||
|
cargo check
|
||||||
|
|
||||||
|
// Build a project with all optimizations turned on
|
||||||
cargo build --release
|
cargo build --release
|
||||||
|
|
||||||
# Build and run (without optimizations) a package with Cargo
|
// Build and run a binary application with Cargo (in debug mode).
|
||||||
cargo run
|
cargo run
|
||||||
|
|
||||||
# Updates dependencies in Cargo.lock
|
// Run the project tests (from src/ and tests/)
|
||||||
cargo update # update all
|
|
||||||
cargo update -p rand # updates just “rand” crate
|
|
||||||
|
|
||||||
# run the project tests (from src/ and tests/)
|
|
||||||
cargo test
|
cargo test
|
||||||
|
|
||||||
# Clean all output build files and targets
|
// Generate rustdoc documentation for your package
|
||||||
|
cargo doc
|
||||||
|
|
||||||
|
// Publishes your package to the registry, using information from Cargo.toml
|
||||||
|
cargo publish
|
||||||
|
|
||||||
|
// Updates dependencies in Cargo.lock
|
||||||
|
cargo update // update all
|
||||||
|
cargo update -p rand // update just "rand" crate
|
||||||
|
|
||||||
|
// Clean all build files
|
||||||
cargo clean
|
cargo clean
|
||||||
|
|
||||||
# search for a package
|
// Search for a package
|
||||||
cargo search
|
cargo search
|
||||||
|
|
||||||
|
// Build and install a binary package into ~/.cargo/bin/
|
||||||
|
cargo install
|
||||||
|
Loading…
Reference in New Issue