rustdoc - generate documentation from Rust source code
Contents
Bugs
See <https://github.com/rust-lang/rust/issues> for issues.
Copyright
This work is dual‐licensed under Apache 2.0 and MIT terms. See COPYRIGHT file in the rust source
distribution.
rustdoc <INSERT VERSION HERE> July 2018 RUSTDOC(1)
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.
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.
Name
rustdoc - generate documentation from Rust source code
Options
-r, --input-formatFORMAT
rust
-w, --output-formatFORMAT
html
-o, --outputOUTPUT,
where to place the output (default: doc/ for html)
--passesLIST
space‐separated list of passes to run (default: '')
--no-defaults
don't run the default passes
--pluginsLIST
space-separated list of plugins to run (default: '')
--plugin-pathDIR
directory to load plugins from (default: /tmp/rustdoc_ng/plugins)
--targetTRIPLE
target triple to document
--crate-nameNAME
specify the name of this crate
-L, --library-pathDIR
directory to add to crate search path
--cfgSPEC
pass a --cfg to rustc
--externVAL
pass an --extern to rustc
--test run code examples as tests
--test-argsARGS
pass arguments to the test runner
--html-in-headerFILE
file to add to <head>
--html-before-contentFILES
files to include inline between <body> and the content of a rendered Markdown file or generated
documentation
--markdown-before-contentFILES
files to include inline between <body> and the content of a rendered Markdown file or generated
documentation
--html-after-contentFILES
files to include inline between the content and </body> of a rendered Markdown file or generated
documentation
--markdown-after-contentFILES
files to include inline between the content and </body> of a rendered Markdown file or generated
documentation
--markdown-cssFILES
CSS files to include via <link> in a rendered Markdown file Markdown file or generated
documentation
--markdown-playground-urlURL
URL to send code snippets to
--markdown-no-toc
don't include table of contents
-h, --extend-css
to redefine some css rules with a given file to generate doc with your own theme
-V, --version
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.
See Also
rustc(1)
Synopsis
rustdoc [OPTIONS] INPUT
