Forrest logo
back to the cargo tool

cargo-add:tldr:1f337

cargo-add: Add a dependency and enable one or more specific features.
$ cargo add ${dependency} --features ${feature_1},${feature_2}
try on your machine

This command is used in the Rust programming language's package manager, Cargo.

The cargo add command is used to add a new dependency to a Rust project. In this specific command, ${dependency} represents the name of the dependency you want to add.

The --features flag is used to enable specific features or capabilities provided by the dependency. Features are optional functionality provided by a crate (Rust's term for libraries or packages). By using this flag, you can specify which features you want to activate for the added dependency.

In the command ${feature_1},${feature_2}, ${feature_1} and ${feature_2} represent the names of the features you want to enable for the dependency. These features are comma-separated, allowing you to enable multiple features at once.

Overall, this command allows you to add a dependency to your Rust project while enabling specific optional features provided by that dependency.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the cargo tool