Scroll to navigation

RUSTDOC(1) User Commands RUSTDOC(1)

NAME

rustdoc - generate documentation from Rust source code

SYNOPSIS

rustdoc [OPTIONS] INPUT

DESCRIPTION

This tool generates API reference documentation by extracting comments from source code written in the Rust language, available at <https://www.rust-lang.org>. It accepts several input formats and provides several output formats for the generated documentation.

OPTIONS

rust
html
where to place the output (default: doc/ for html)
space‐separated list of passes to run (default: '')
don't run the default passes
space-separated list of plugins to run (default: '')
directory to load plugins from (default: /tmp/rustdoc_ng/plugins)
target triple to document
specify the name of this crate
directory to add to crate search path
pass a --cfg to rustc
pass an --extern to rustc
run code examples as tests
pass arguments to the test runner
file to add to <head>
files to include inline between <body> and the content of a rendered Markdown file or generated documentation
files to include inline between <body> and the content of a rendered Markdown file or generated documentation
files to include inline between the content and </body> of a rendered Markdown file or generated documentation
files to include inline between the content and </body> of a rendered Markdown file or generated documentation
CSS files to include via <link> in a rendered Markdown file Markdown file or generated documentation
URL to send code snippets to
don't include table of contents
to redefine some css rules with a given file to generate doc with your own theme
Print rustdoc's version

OUTPUT FORMATS

The rustdoc tool can generate output in an HTML format.

If using an HTML format, then the specified output destination will be the root directory of an HTML structure for all the documentation. Pages will be placed into this directory, and source files will also possibly be rendered into it as well.

EXAMPLES

To generate documentation for the source in the current directory:
$ rustdoc hello.rs

List all available passes that rustdoc has, along with default passes:
$ rustdoc --passes list

The generated HTML can be viewed with any standard web browser.

SEE ALSO

rustc(1)

BUGS

See <https://github.com/rust-lang/rust/issues> for issues.

AUTHOR

See the version control history or <https://thanks.rust-lang.org>

COPYRIGHT

This work is dual‐licensed under Apache 2.0 and MIT terms. See COPYRIGHT file in the rust source distribution.

September 2021 rustdoc 1.50.0