RUSTDOC(1)

๐Ÿ’– NAME ๐Ÿ’–

rustdoc โ€” the iconic little tool that generates documentation from Rust source code โœจ periodt


๐ŸŒธ SYNOPSIS ๐ŸŒธ

rustdoc [OPTIONS] INPUT

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so bestie, listen. This tool generates API reference documentation by pulling comments straight out of source code written in the Rust language โ€” Rust lives at https://www.rust-lang.org, iykyk ๐Ÿ’…

It accepts several input formats and provides several output formats for the generated documentation. She's flexible like that ๐ŸŽ€


โœจ OPTIONS โœจ

  • -r, --input-format FORMAT โ€” the input format, and the only one listed here is rust ๐Ÿฆ€
  • -w, --output-format FORMAT โ€” the output format, which here is html ๐Ÿ’–
  • -o, --output OUTPUT โ€” where to place the output (default: doc/ for html) ๐Ÿ“
  • --passes LIST โ€” a space-separated list of passes to run (default: '')
  • --no-defaults โ€” don't run the default passes, we're doing our own thing ๐Ÿ˜ค
  • --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, no spoilers bestie
  • -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. Just the one, and honestly? She ate. ๐Ÿ”ฅ

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. literally any of them, no cap ๐ŸŒ


๐Ÿ’œ SEE ALSO ๐Ÿ’œ


๐Ÿ’€ BUGS ๐Ÿ’€

See https://github.com/rust-lang/rust/issues for issues. (yes bestie, we know, pls report them ๐Ÿ™ˆ)


โญ AUTHOR โญ

See the version control history or https://thanks.rust-lang.org ๐Ÿซถ


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


and that's the whole vibe: rustdoc 1.99.1 (58cf8f9c3 2026-... July 2018) โ€” go make some docs, bestie, you're gonna slay ๐Ÿฆ‹๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from