2016-05-05 02:39:32 +01:00
|
|
|
# cargo
|
|
|
|
|
|
|
|
> Rust package manager.
|
|
|
|
> Manage Rust projects and their module dependencies (crates).
|
|
|
|
|
|
|
|
- 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`
|
|
|
|
|
|
|
|
- Build with multiple parallel jobs:
|
|
|
|
|
|
|
|
`cargo build -j {{jobs}}`
|