Cargo add
cargo add is a Cargo subcommand that adds a dependency declaration and its configuration to a Rust package’s manifest.
Rust in Action: Systems programming concepts and techniques
cargo add is a Cargo subcommand that adds a dependency declaration to a Rust project's manifest.
- How it is used
- Adds third-party crates to Rust projects during practical development workflows.
- How deep it goes
- Explains the command, manifest edit, and subsequent compilation, but stops short of its implementation internals.
- Examples
- Uses grep-lite with regex and a Mandelbrot renderer with num as hands-on dependency examples.
- What you can do after
- Operate/configure Cargo by adding dependencies and then building or running projects that use them.
Read how Rust in Action: Systems programming concepts and techniques explains cargo add →
Learn Rust in a Month of Lunches
cargo add is a Cargo command that adds an external crate dependency to a package manifest.
- How it is used
- Adds external crates to a Rust package through Cargo.toml.
- How deep it goes
- Defines the command, its manifest effect, and subsequent download behavior without detailing dependency resolution internals.
- Examples
- Uses cargo add rand and shows rand = "0.8.5" under [dependencies].
- What you can do after
- Operate/configure a Cargo project by adding an external crate from the command line.
Read how Learn Rust in a Month of Lunches explains cargo add →
Related concepts
- dependencyconfigures · A software dependency is a component, resource, or prerequisite on which another software component or operation relies to function or proceed.
- synconfigures · syn is a Rust library for parsing source code into syntax trees and manipulating their token representations.
- quoteconfigures · quote is a Rust crate and macro for constructing Rust token streams from quasi-quoted syntax.
- cargo.tomlconfigures · Cargo.toml is a TOML-formatted Rust package manifest declaring project metadata, dependencies, targets, and build configuration.
- randuses · rand is a Rust library crate providing random-number generation and related randomization utilities.
- reqwestuses · Reqwest is a Rust HTTP client library for constructing requests and processing responses, including through asynchronous clients.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

