]> git.proxmox.com Git - rustc.git/blob - man/rustdoc.1
New upstream version 1.12.0+dfsg1
[rustc.git] / man / rustdoc.1
1 .TH RUSTDOC "1" "August 2016" "rustdoc 1.12.0" "User Commands"
2 .SH NAME
3 rustdoc \- generate documentation from Rust source code
4 .SH SYNOPSIS
5 .B rustdoc
6 [\fIOPTIONS\fR] \fIINPUT\fR
7
8 .SH DESCRIPTION
9 This tool generates API reference documentation by extracting comments from
10 source code written in the Rust language, available at
11 <\fBhttps://www.rust-lang.org\fR>. It accepts several input formats and
12 provides several output formats for the generated documentation.
13
14 .SH OPTIONS
15
16 .TP
17 \fB\-r\fR, \fB\-\-input\-format\fR \fIFORMAT\fR
18 html or json (default: inferred)
19 .TP
20 \fB\-w\fR, \fB\-\-output\-format\fR \fIFORMAT\fR
21 html or json (default: html)
22 .TP
23 \fB\-o\fR, \fB\-\-output\fR \fIOUTPUT\fR
24 where to place the output (default: \fIdoc/\fR for html,
25 \fIdoc.json\fR for json)
26 .TP
27 \fB\-\-passes\fR \fILIST\fR
28 space\[hy]separated list of passes to run (default: '')
29 .TP
30 \fB\-\-no\-defaults\fR
31 don't run the default passes
32 .TP
33 \fB\-\-plugins\fR \fILIST\fR
34 space-separated list of plugins to run (default: '')
35 .TP
36 \fB\-\-plugin\-path\fR \fIDIR\fR
37 directory to load plugins from (default: \fI/tmp/rustdoc_ng/plugins\fR)
38 .TP
39 \fB\-\-target\fR \fITRIPLE\fR
40 target triple to document
41 .TP
42 \fB\-\-crate\-name\fR \fINAME\fR
43 specify the name of this crate
44 .TP
45 \fB\-L\fR, \fB\-\-library\-path\fR \fIDIR\fR
46 directory to add to crate search path
47 .TP
48 \fB\-\-cfg\fR \fISPEC\fR
49 pass a \fI\-\-cfg\fR to rustc
50 .TP
51 \fB\-\-extern\fR \fIVAL\fR
52 pass an \fI\-\-extern\fR to rustc
53 .TP
54 \fB\-\-test\fR
55 run code examples as tests
56 .TP
57 \fB\-\-test\-args\fR \fIARGS\fR
58 pass arguments to the test runner
59 .TP
60 \fB\-\-html\-in\-header\fR \fIFILE\fR
61 file to add to <head>
62 .TP
63 \fB\-\-html\-before\-content\fR \fIFILE\fR
64 file to add in <body>, before content
65 .TP
66 \fB\-\-html\-after\-content\fR \fIFILE\fR
67 file to add in <body>, after content
68 .TP
69 \fB\-\-markdown\-css\fR \fIFILE\fR
70 CSS files to include via <link> in a rendered Markdown file
71 .TP
72 \fB\-\-markdown\-playground\-url\fR \fIURL\fR
73 URL to send code snippets to
74 .TP
75 \fB\-\-markdown\-no\-toc\fR
76 don't include table of contents
77 .TP
78 \fB\-h\fR, \fB\-\-help\fR
79 Print help
80 .TP
81 \fB\-V\fR, \fB\-\-version\fR
82 Print rustdoc's version
83
84 .SH "OUTPUT FORMATS"
85
86 The rustdoc tool can generate output in either an HTML or JSON format.
87
88 If using an HTML format, then the specified output destination will be the root
89 directory of an HTML structure for all the documentation.
90 Pages will be placed into this directory, and source files will also
91 possibly be rendered into it as well.
92
93 If using a JSON format, then the specified output destination will have the
94 rustdoc output serialized as JSON into it.
95 This output format exists to pre\[hy]compile documentation for crates,
96 and for usage in non\[hy]rustdoc tools.
97 The JSON output is the following hash:
98
99 {
100 "schema": VERSION,
101 "crate": ...,
102 "plugins": ...,
103 }
104
105 The schema version indicates what the structure of crate/plugins will
106 look like.
107 Within a schema version the structure will remain the same.
108 The \fIcrate\fR field will contain all relevant documentation for the
109 source being documented, and the \fIplugins\fR field will contain the
110 output of the plugins run over the crate.
111
112 .SH "EXAMPLES"
113
114 To generate documentation for the source in the current directory:
115 $ rustdoc hello.rs
116
117 List all available passes that rustdoc has, along with default passes:
118 $ rustdoc \-\-passes list
119
120 To precompile the documentation for a crate, and then use it to render html at
121 a later date:
122 $ rustdoc \-w json hello.rs
123 $ rustdoc doc.json
124
125 The generated HTML can be viewed with any standard web browser.
126
127 .SH "SEE ALSO"
128
129 .BR rustc (1)
130
131 .SH "BUGS"
132 See <\fBhttps://github.com/rust\-lang/rust/issues\fR>
133 for issues.
134
135 .SH "AUTHOR"
136 See \fIAUTHORS.txt\fR in the Rust source distribution.
137
138 .SH "COPYRIGHT"
139 This work is dual\[hy]licensed under Apache\ 2.0 and MIT terms.
140 See \fICOPYRIGHT\fR file in the rust source distribution.