LinuxCommandLibrary

cargo-rustdoc

Build documentation with extra rustdoc flags

TLDR

Build docs with rustdoc options

$ cargo rustdoc -- [rustdoc_flags]
copy
Document with private items
$ cargo rustdoc -- --document-private-items
copy
Output JSON format (nightly)
$ cargo rustdoc -Z unstable-options --output-format json
copy
Document specific binary
$ cargo rustdoc --bin [name] -- [flags]
copy
Build docs for all features
$ cargo rustdoc --all-features
copy

SYNOPSIS

cargo rustdoc [options] [-- args]

DESCRIPTION

cargo rustdoc builds documentation for the current package and passes extra options directly to the rustdoc tool. Arguments after `--` are forwarded only to the final rustdoc invocation for the specified target, not to dependencies.
This command is similar to `cargo doc` but provides fine-grained control over rustdoc flags. Common uses include documenting private items, generating JSON output for tooling (on nightly), and passing custom HTML or CSS settings. Only one target can be documented at a time when extra arguments are provided.

PARAMETERS

--open

Open docs in browser after building
--lib
Document library only
--bin name
Document specified binary
--bins
Document all binaries
--example name
Document specified example
--examples
Document all examples
-p, --package spec
Package to document
--target triple
Document for target platform
-j, --jobs n
Parallel jobs
--features features
Enable features
--all-features
Enable all features
--no-default-features
Disable default features

OUTPUT FORMATS

html

HTML documentation (default)
json
JSON format (nightly, experimental)

CAVEATS

Only one target can be documented when passing extra arguments. Use target filters to select.

SEE ALSO

cargo(1), cargo-doc(1), rustdoc(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community