-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed1518e
commit 42e2ab1
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# cargo add | ||
|
||
> Add dependencies to a Rust project's `Cargo.toml` file. | ||
> More information: <https://doc.rust-lang.org/cargo/commands/cargo-add.html>. | ||
- Add the latest version of a dependency to the current project: | ||
|
||
`cargo add {{dependency}}` | ||
|
||
- Add a specific version of a dependency: | ||
|
||
`cargo add {{dependency}}@{{version}}` | ||
|
||
- Add a dependency and enable one or more specific features: | ||
|
||
`cargo add {{dependency}} --features {{feature_1}},{{feature_2}}` | ||
|
||
- Add an optional dependency, which then gets exposed as a feature of the crate: | ||
|
||
`cargo add {{dependency}} --optional` | ||
|
||
- Add a local crate as a dependency: | ||
|
||
`cargo add --path {{path/to/crate}}` | ||
|
||
- Add a development or build dependency: | ||
|
||
`cargo add {{dependency}} --{{dev|build}}` | ||
|
||
- Add a dependency with all default features disabled: | ||
|
||
`cargo add {{dependency}} --no-default-features` |