cargo-doc man page

cargo-doc — Build a package's documentation


cargo doc [Options]


Build a package's documentation.

By default the documentation for the local package and all dependencies is built. The output is all placed in 'target/doc' in rustdoc's usual format.

If the --package argument is given, then SPEC is a package id specification which indicates which package should be built. If it is not given, then the current package is built. For more information on SPEC and its format, see the "cargo help pkgid" command.


-h, --help

Print this message.

-p SPEC, --package SPEC ...

Package to document.


Opens the docs in a browser after the operation.


Don't build documentation for dependencies.

-j N, --jobs N

Number of parallel jobs, defaults to # of CPUs.


Build artifacts in release mode, with optimizations.

--features FEATURES

Space-separated list of features to also build.


Build all available features.


Do not build the default feature.

--target TRIPLE

Build for the target triple.

--manifest-path PATH

Path to the Cargo.toml to compile.

-v, --verbose

Use verbose output.

-q, --quiet

No output printed to stdout.

--color WHEN

Coloring: auto, always, never.


Build a local package documentation in 'target/doc'

$ cargo doc

See Also

cargo(1), cargo-build(1)

Referenced By

cargo(1), cargo-rustdoc(1).

May 2016 The Rust package manager Cargo Manual