Update cheatsheets

This commit is contained in:
ivuorinen
2024-02-21 11:19:49 +00:00
parent 4e88a1b42f
commit 3d653cc7e6
4803 changed files with 127002 additions and 0 deletions

37
cargo-add Normal file
View File

@@ -0,0 +1,37 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# cargo add
> Add dependencies to a Rust project's `Cargo.toml` manifest.
> 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_directory}}`
- 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`