RUSTDOC(1)

πŸ“¦ version 1.97.1, in ubuntu stonking

πŸ’… rustdoc (1) β€” User Commands πŸ’…

okay bestie, welcome to the rustdoc page 🌈 this is the tool that takes your Rust source code and turns your comments into ✨glorious API reference documentation✨


✨ NAME ✨

rustdoc β€” generate documentation from Rust source code πŸ¦‹


✨ SYNOPSIS ✨

rustdoc [OPTIONS] INPUT

✨ DESCRIPTION ✨

so the way that this works πŸ’– rustdoc generates API reference documentation by extracting comments from source code written in the Rust language, which lives at <https://www.rust-lang.org> in case you need it. it accepts several input formats and provides several output formats for the generated documentation. it's giving "your comments but make them a website" and we're obsessed 😌✨


✨ OPTIONS ✨

  • -r, --input-format FORMAT β€” the input format, and bestie the value is rust πŸ¦€
  • -w, --output-format FORMAT β€” the output format, and the value here is html 🌸
  • -o, --output OUTPUT, β€” where to place the output (default: doc/ for html). also yes there is a little stray comma in there, we love her, she stays πŸ’€
  • --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 πŸ§ͺ lowkey iconic of her
  • --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 🎨 (yeah she said "Markdown file" twice, no cap, we're keeping it exactly as she is πŸ’…)
  • --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 🎨 (yes, -h is the short flag for this one here, not help β€” stay woke bestie πŸ‘€)
  • -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. so like, everything's going in there, it's the whole vibe 🏠✨


✨ 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 🌐 main character browsing experience fr fr


✨ SEE ALSO ✨

rustc(1) β€” go say hi to her sibling πŸ’–


✨ BUGS ✨

found a bug? see <https://github.com/rust-lang/rust/issues> for issues πŸ› no pressure but like, tell them


✨ AUTHOR ✨

see the version control history or <https://thanks.rust-lang.org> 🫢 shoutout to everyone in the git log


this work is dual-licensed under Apache 2.0 and MIT terms πŸ“œ see COPYRIGHT file in the rust source distribution.


okay that's the whole page bestie, you ate that πŸ’…βœ¨

signing off with the vibe check: this was rustdoc 1.97.1 (8bab26f4f 2026-... from July 2018 🌸 (yes the date is a whole situation, don't @ her), and we're out here being RUSTDOC(1) β€” periodt πŸ‘‘πŸ’–

πŸ“¦ where this page comes from