rustdoc man page

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

-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/plugins)

--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 rendered Markdown file or generated documentation

--markdown-before-content FILES

files to include inline between <body> and the content of a rendered 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.

See Also

rustc(1)

Bugs

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

Author

See AUTHORS.txt in the Rust source distribution.

Referenced By

cargo(1), rustc(1).

May 2017 rustdoc 1.19.0 User Commands