2016-05-05 02:39:32 +01:00
|
|
|
# cargo
|
|
|
|
|
|
|
|
> Rust package manager.
|
|
|
|
> Manage Rust projects and their module dependencies (crates).
|
2019-06-03 01:06:36 +01:00
|
|
|
> More information: <https://crates.io/>.
|
2016-05-05 02:39:32 +01:00
|
|
|
|
|
|
|
- Search for crates:
|
|
|
|
|
|
|
|
`cargo search {{search_string}}`
|
|
|
|
|
|
|
|
- Install a crate:
|
|
|
|
|
|
|
|
`cargo install {{crate_name}}`
|
|
|
|
|
|
|
|
- List installed crates:
|
|
|
|
|
|
|
|
`cargo install --list`
|
|
|
|
|
2019-01-13 04:00:16 +00:00
|
|
|
- Create a new binary or library Rust project in the current directory:
|
2016-05-05 02:39:32 +01:00
|
|
|
|
2019-01-13 04:00:16 +00:00
|
|
|
`cargo init --{{bin|lib}}`
|
2016-05-05 02:39:32 +01:00
|
|
|
|
2019-01-13 04:00:16 +00:00
|
|
|
- Create a new binary or library Rust project in the specified directory:
|
2016-05-05 02:39:32 +01:00
|
|
|
|
2019-01-13 04:00:16 +00:00
|
|
|
`cargo new {{path/to/directory}} --{{bin|lib}}`
|
2016-05-05 02:39:32 +01:00
|
|
|
|
|
|
|
- Build the Rust project in the current directory:
|
|
|
|
|
|
|
|
`cargo build`
|
|
|
|
|
2019-10-27 11:25:50 +00:00
|
|
|
- Build using a specific number of threads (default is the number of CPU cores):
|
2016-05-05 02:39:32 +01:00
|
|
|
|
|
|
|
`cargo build -j {{jobs}}`
|