cargo-add

Add dependencies to a Rust project's `Cargo.toml` file.

TLDR

Add the latest version of a dependency to the current project

$ cargo add [dependency]
copy


Add a specific version of a dependency
$ cargo add [dependency]@[version]
copy


Add a dependency and enable one or more specific features
$ cargo add [dependency] --features [feature_1],[feature_2]
copy


Add an optional dependency, which then gets exposed as a feature of the crate
$ cargo add [dependency] --optional
copy


Add a local crate as a dependency
$ cargo add --path [path/to/crate]
copy


Add a development or build dependency
$ cargo add [dependency] --[dev|build]
copy


Add a dependency with all default features disabled
$ cargo add [dependency] --no-default-features
copy

Copied to clipboard