tldr/pages/common/cargo.md

34 lines
645 B
Markdown
Raw Normal View History

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