rustdoc - generate documentation from Rust source code
rustdoc [OPTIONS] INPUT
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 pro-
vides several output formats for the generated documentation.
OPTIONS
-r, --input-format FORMAT
rust
-w, --output-format FORMAT
html
-o, --output OUTPUT,
where to place the output (default: doc/ for html)
--passes LIST
space-separated list of passes to run (default: '')
--no-defaults
don't run the default passes
--plugins LIST
space-separated list of plugins to run (default: '')
--plugin-path DIR
directory to load plugins from (default: /tmp/rustdoc_ng/plug-
ins)
--target TRIPLE
target triple to document
--crate-name NAME
specify the name of this crate
-L, --library-path DIR
directory to add to crate search path
--cfg SPEC
pass a --cfg to rustc
--extern VAL
pass an --extern to rustc
--test run code examples as tests
--test-args ARGS
pass arguments to the test runner
--html-in-header FILE
file to add to <head>
--html-before-content FILES
files to include inline between <body> and the content of a ren-
dered Markdown file or generated documentation
--markdown-before-content FILES
files to include inline between <body> and the content of a ren-
dered Markdown file or generated documentation
--html-after-content FILES
files to include inline between the content and </body> of a
rendered Markdown file or generated documentation
--markdown-after-content FILES
files to include inline between the content and </body> of a
rendered Markdown file or generated documentation
--markdown-css FILES
CSS files to include via <link> in a rendered Markdown file
Markdown file or generated documentation
--markdown-playground-url URL
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.
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.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
+---------------+----------------------+
|ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+---------------+----------------------+
|Availability | developer/rust/rustc |
+---------------+----------------------+
|Stability | Volatile |
+---------------+----------------------+
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 COPY-
RIGHT file in the rust source distribution.
NOTES
Source code for open source software components in Oracle Solaris can
be found at https://www.oracle.com/downloads/opensource/solaris-source-
code-downloads.html.
This software was built from source available at
https://github.com/oracle/solaris-userland. The original community
source was downloaded from https://static.rust-
lang.org/dist/rustc-1.53.0-src.tar.xz.
Further information about this software can be found on the open source
community website at http://www.rust-lang.org/.
rustdoc 1.53.0 June 2022 RUSTDOC(1)