LinuxCommandLibrary

cargo-doc

TLDR

Build documentation

$ cargo doc
copy
Build and open in browser
$ cargo doc --open
copy
Build without dependencies
$ cargo doc --no-deps
copy
Include private items
$ cargo doc --document-private-items
copy
Build for all workspace members
$ cargo doc --workspace
copy
Build with release profile
$ cargo doc --release
copy
Build with all features
$ cargo doc --all-features
copy

SYNOPSIS

cargo doc [options]

DESCRIPTION

cargo doc builds documentation for the local package and all dependencies using rustdoc. Output placed in target/doc/ in HTML format.

PARAMETERS

--open

Open documentation in browser after building
--no-deps
Don't build documentation for dependencies
--document-private-items
Include non-public items (default for binaries)
-r, --release
Build with release profile
--workspace
Document all workspace members
--exclude spec
Exclude packages (with --workspace)
-p, --package spec
Document specific packages
--lib
Document library only
--bins
Document all binaries
--target triple
Document for target architecture
-j, --jobs n
Parallel jobs (default: CPU count)
--features features
Enable specified features
--all-features
Enable all features
--no-default-features
Disable default features

ENVIRONMENT

BROWSER

Browser to use with --open

OUTPUT

Documentation generated in target/doc/<crate_name>/index.html

CAVEATS

Skips binaries with same name as library. Skips binaries with missing required features.

SEE ALSO

cargo(1), rustdoc(1)

Copied to clipboard