-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
cargo.md
37 lines (20 loc) · 986 Bytes
/
cargo.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# cargo
> Manage Rust projects and their module dependencies (crates).
> Some subcommands such as `build` have their own usage documentation.
> More information: <https://doc.rust-lang.org/cargo>.
- Search for crates:
`cargo search {{search_string}}`
- Install a binary crate:
`cargo install {{crate_name}}`
- List installed binary crates:
`cargo install --list`
- Create a new binary or library Rust project in the specified directory (or the current working directory by default):
`cargo init --{{bin|lib}} {{path/to/directory}}`
- Add a dependency to `Cargo.toml` in the current directory:
`cargo add {{dependency}}`
- Build the Rust project in the current directory using the release profile:
`cargo build --release`
- Build the Rust project in the current directory using the nightly compiler (requires `rustup`):
`cargo +nightly build`
- Build using a specific number of threads (default is the number of logical CPUs):
`cargo build --jobs {{number_of_threads}}`