Command | Description |
---|---|
cargo new | Create a new Rust project |
cargo build | Build the Rust project |
cargo run | Build and run the Rust project |
cargo test | Run tests in the Rust project |
cargo doc | Generate documentation for the Rust project |
cargo clean | Clean the target directory of the Rust project |
cargo update | Update dependencies of the Rust project |
cargo check | Check the Rust project for errors without building |
cargo publish | Publish the Rust crate to crates.io |
cargo install | Install a Rust binary as a crate |
Command | Description |
---|---|
rustc | Compile a Rust source file into an executable or library |
rustc --version | Show the version of the Rust compiler |
rustc --help | Show the help message for the Rust compiler |
rustc <source_file.rs> | Compile a specific Rust source file |
rustc -O <source_file.rs> | Compile a Rust source file with optimizations |
rustc --crate-type | Specify the type of output crate (e.g., bin, lib) |
rustc --out-dir | Specify the output directory for the compiled crate |
rustc --emit | Specify the type of output files (e.g., asm, ir, obj) |
Command | Description |
---|---|
rustup update | Update the Rust toolchain |
rustup show | Show the currently installed Rust toolchain |
rustup install | Install a specific Rust toolchain |
rustup uninstall | Uninstall a Rust toolchain |
rustup default | Set the default Rust toolchain |
rustup override | Set the Rust toolchain for a specific directory |
rustup target | Add or remove Rust target platforms |
rustup component | Install or uninstall Rust components (e.g., rustfmt, clippy) |
rustup self | Update the Rustup toolchain installer |
rustup doc | Open the Rust documentation in a web browser |