RUSTDOC(1)
β¨ RUSTDOC(1) β¨
okay bestie, welcome to rustdoc β it's a User Command, it lives in section 1 of the manual, and it is genuinely one of the most useful little gremlins in the whole Rust toolbox. let's get into it π
πΈ NAME πΈ
rustdoc β generate documentation from Rust source code. that's it. that's the girl. she reads your comments and turns them into a whole website. iconic behavior honestly π
π SYNOPSIS π
rustdoc [OPTIONS] INPUT
so like. options first, then the input. in that order. don't fight it.
π¦ 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.
fr fr, it just goes through your Rust code, scoops out the doc comments you wrote, and serves them up as pretty documentation. she's flexible too β multiple input formats go in, multiple output formats come out. main character energy π«Ά
β¨ OPTIONS β¨
one bullet per flag, no skipping, we're doing all of them:
-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. like, skip the usual routine entirely π--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--cfgtorustc--extern VALβ pass an--externtorustc--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
ngl, yes, that-hreally is--extend-cssin this manpage. we don't make the rules, we just document them exactly as they are. no cap π
π 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 basically: you point her at a folder, she makes that folder the root of the whole HTML situation. pages go in there, source files might get rendered in there too. it's giving little documentation ecosystem π§
π 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.
look at that. two commands. so easy. go open it in a browser and feel like a genius π
β SEE ALSO β
π BUGS π
See <https://github.com/rust-lang/rust/issues> for issues.
(yes bestie, bugs happen, that's literally where you report them π)
πΈ 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 COPYRIGHT file in the rust source distribution.
and that's the whole page, bestie π this one's from the rustdoc manual, version <INSERT VERSION HERE>, dated July 2018. slay, go document something π¦β¨
π¦ where this page comes from
- ubuntu questing: rustc-1.88 1.88.0+dfsg0ubuntu1-0ubuntu1
- ubuntu questing: rustc-1.88 1.88.0+dfsg0ubuntu1-0ubuntu2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms