= cargo-doc(1)
:idprefix: cargo_doc_
:doctype: manpage
:actionverb: Document
== NAME
cargo-doc - Build a package's documentation
== SYNOPSIS
`cargo doc [_OPTIONS_]`
== DESCRIPTION
Build the documentation for the local package and all dependencies. The output
is placed in `target/doc` in rustdoc's usual format.
== OPTIONS
=== Documentation Options
*--open*::
Open the docs in a browser after building them.
*--no-deps*::
Do not build documentation for dependencies.
*--document-private-items*::
Include non-public items in the documentation.
=== Package Selection
include::options-packages.adoc[]
=== Target Selection
When no target selection options are given, `cargo doc` will document all
binary and library targets of the selected package. The binary will be skipped
if its name is the same as the lib target. Binaries are skipped if they have
`required-features` that are missing.
The default behavior can be changed by setting `doc = false` for the target in
the manifest settings. Using target selection options will ignore the `doc`
flag and will always document the given target.
include::options-targets-lib-bin.adoc[]
include::options-features.adoc[]
=== Compilation Options
include::options-target-triple.adoc[]
include::options-release.adoc[]
=== Output Options
include::options-target-dir.adoc[]
=== Display Options
include::options-display.adoc[]
include::options-message-format.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
=== Miscellaneous Options
include::options-jobs.adoc[]
include::section-profiles.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Build the local package documentation and its dependencies and output to
`target/doc`.
cargo doc
== SEE ALSO
man:cargo[1], man:cargo-rustdoc[1], man:rustdoc[1]