Cargo doc
cargo doc is a Cargo command that generates documentation for Rust packages and their dependencies.
Idiomatic Rust
cargo doc is Cargo's command for generating documentation for a Rust package and its dependencies.
- How it is used
- Supports API review and user onboarding by generating browsable documentation for a Rust crate.
- How deep it goes
- Generates HTML and explains documentation comments, but stops short of documenting advanced configuration.
- Examples
- Uses a linkedlist crate, LinkedList API pages, crate-level examples, and target/doc output.
- What you can do after
- Operate Cargo to generate documentation, inspect public APIs, and regenerate pages during editing.
Learn Rust in a Month of Lunches
cargo doc is the Cargo command-line tool that generates documentation for Rust packages and their dependencies, with --open optionally opening the generated documentation.
- How it is used
- Generates local, browsable documentation for Rust code, including APIs from external crates.
- How deep it goes
- Explains generation, browser opening, API listings, comments, and dependency selection without covering documentation internals.
- Examples
- Uses DoesNothing, PrintThing, a printing method, automatic traits, blanket implementations, and /// comments.
- What you can do after
- Apply it via Cargo to generate and inspect documentation for a Rust project or its dependencies.
Read how Learn Rust in a Month of Lunches explains cargo doc →
Related concepts
- documentationproduces · Documentation is recorded explanatory, instructional, or reference information that describes a subject, system, or process to support its understanding, use, or maintenance.
- rustdocuses · rustdoc is Rust’s documentation generator, producing reference documentation from source code and documentation comments.
- HTMLproduces · HTML (HyperText Markup Language) is the standard markup language for structuring content and elements in web documents.
- browseruses · A web browser is software that retrieves, interprets, and renders web resources, executes supported web content, and enables interaction with web pages and applications.
- standard libraryuses · A standard library is a collection of reusable modules, types, functions, APIs, and other facilities distributed with a programming language implementation or platform.
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.

