1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/cargo.md
blakehawkins e5521801d6
cargo: add +nightly example (#8475)
The `+nightly` syntax is somewhat unusual and easy to forget. It composes nicely with many other cargo commands. None of the others have a +nightly example as yet.
2022-09-08 04:41:59 +05:30

870 B

cargo

Manage Rust projects and their module dependencies (crates). Some subcommands such as cargo build have their own usage documentation. More information: https://crates.io/.

  • Search for crates:

cargo search {{search_string}}

  • Install a crate:

cargo install {{crate_name}}

  • List installed crates:

cargo install --list

  • Create a new binary or library Rust project in the current directory:

cargo init --{{bin|lib}}

  • Create a new binary or library Rust project in the specified directory:

cargo new {{path/to/directory}} --{{bin|lib}}

  • Build the Rust project in the current directory:

cargo build

  • Build the rust project in the current directory using the nightly compiler:

cargo +nightly build

  • Build using a specific number of threads (default is the number of CPU cores):

cargo build --jobs {{number_of_threads}}