Forrest logo
back to the cargo tool

cargo-add:tldr:371d4

cargo-add: Add a development or build dependency.
$ cargo add ${dependency} --${select}
try on your machine

The "cargo add" command is a command used in Rust programming language to add a dependency to a project.

In this specific command, "${dependency}" and "${select}" are variables or placeholders that need to be replaced with actual values.

  • "${dependency}" should be replaced with the name of the dependency you want to add to your project. For example, if you want to add the "serde" dependency, you would replace "${dependency}" with "serde".

  • "${select}" should be replaced with an optional selection specifier that indicates the version or edition of the dependency you want to add. For example, if you want to add the "serde" dependency with the latest version, you would replace "${select}" with "--latest".

To summarize, the command "cargo add ${dependency} --${select}" is used to add a dependency to a Rust project, where "${dependency}" is the name of the dependency and "${select}" is an optional selection specifier.

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