dev: For development (cargo build).release: For production (cargo build --release).Cargo.tomlopt-level: Optimization levels (0-3).
cargo login to store it locally.Cargo.toml:cargo publish./// for documentation comments./// Adds one to the input number.
///
/// # Examples
///
/// ```
/// let result = my_crate::add_one(1);
/// assert_eq!(result, 2);
/// ```
pub fn add_one(x: i32) -> i32 {
x + 1
}cargo doc --open to generate HTML documentationcargo testCargo.lock (dependency versions).target directory (build artifacts).Benefits: - Simplifies management of interdependent crates. - Avoids redundant compilation of dependencies.
cargo build.cargo test -p crate1.cargo install:Binaries stored in ~/.cargo/bin (add to $PATH).
Run the tool:
cargo-<command>.cargo <command>.cargo-fancy:Benefits: - Extend Cargo without modifying it. - Automatically integrates into cargo --list.