1RUSTDOC(1) User Commands RUSTDOC(1)
2
3
4
6 rustdoc - generate documentation from Rust source code
7
9 rustdoc [OPTIONS] INPUT
10
11
13 This tool generates API reference documentation by extracting comments
14 from source code written in the Rust language, available at
15 <https://www.rust-lang.org>. It accepts several input formats and pro‐
16 vides several output formats for the generated documentation.
17
18
20 -r, --input-format FORMAT
21 rust
22
23 -w, --output-format FORMAT
24 html
25
26 -o, --output OUTPUT,
27 where to place the output (default: doc/ for html)
28
29 --passes LIST
30 space‐separated list of passes to run (default: '')
31
32 --no-defaults
33 don't run the default passes
34
35 --plugins LIST
36 space-separated list of plugins to run (default: '')
37
38 --plugin-path DIR
39 directory to load plugins from (default: /tmp/rustdoc_ng/plug‐
40 ins)
41
42 --target TRIPLE
43 target triple to document
44
45 --crate-name NAME
46 specify the name of this crate
47
48 -L, --library-path DIR
49 directory to add to crate search path
50
51 --cfg SPEC
52 pass a --cfg to rustc
53
54 --extern VAL
55 pass an --extern to rustc
56
57 --test run code examples as tests
58
59 --test-args ARGS
60 pass arguments to the test runner
61
62 --html-in-header FILE
63 file to add to <head>
64
65 --html-before-content FILES
66 files to include inline between <body> and the content of a ren‐
67 dered Markdown file or generated documentation
68
69 --markdown-before-content FILES
70 files to include inline between <body> and the content of a ren‐
71 dered Markdown file or generated documentation
72
73 --html-after-content FILES
74 files to include inline between the content and </body> of a
75 rendered Markdown file or generated documentation
76
77 --markdown-after-content FILES
78 files to include inline between the content and </body> of a
79 rendered Markdown file or generated documentation
80
81 --markdown-css FILES
82 CSS files to include via <link> in a rendered Markdown file
83 Markdown file or generated documentation
84
85 --markdown-playground-url URL
86 URL to send code snippets to
87
88 --markdown-no-toc
89 don't include table of contents
90
91 -h, --extend-css
92 to redefine some css rules with a given file to generate doc
93 with your own theme
94
95 -V, --version
96 Print rustdoc's version
97
98
100 The rustdoc tool can generate output in an HTML format.
101
102 If using an HTML format, then the specified output destination will be
103 the root directory of an HTML structure for all the documentation.
104 Pages will be placed into this directory, and source files will also
105 possibly be rendered into it as well.
106
107
109 To generate documentation for the source in the current directory:
110 $ rustdoc hello.rs
111
112 List all available passes that rustdoc has, along with default passes:
113 $ rustdoc --passes list
114
115 The generated HTML can be viewed with any standard web browser.
116
117
119 rustc(1)
120
121
123 See <https://github.com/rust-lang/rust/issues> for issues.
124
125
127 See the version control history or <https://thanks.rust-lang.org>
128
129
131 This work is dual‐licensed under Apache 2.0 and MIT terms. See COPY‐
132 RIGHT file in the rust source distribution.
133
134
135
136rustdoc 1.52.1 May 2021 RUSTDOC(1)