]> git.proxmox.com Git - rustc.git/blob - src/tools/cargo/src/doc/man/cargo-doc.md
New upstream version 1.70.0+dfsg2
[rustc.git] / src / tools / cargo / src / doc / man / cargo-doc.md
1 # cargo-doc(1)
2 {{*set actionverb="Document"}}
3 {{*set multitarget=true}}
4
5 ## NAME
6
7 cargo-doc --- Build a package's documentation
8
9 ## SYNOPSIS
10
11 `cargo doc` [_options_]
12
13 ## DESCRIPTION
14
15 Build the documentation for the local package and all dependencies. The output
16 is placed in `target/doc` in rustdoc's usual format.
17
18 ## OPTIONS
19
20 ### Documentation Options
21
22 {{#options}}
23
24 {{#option "`--open`" }}
25 Open the docs in a browser after building them. This will use your default
26 browser unless you define another one in the `BROWSER` environment variable
27 or use the [`doc.browser`](../reference/config.html#docbrowser) configuration
28 option.
29 {{/option}}
30
31 {{#option "`--no-deps`" }}
32 Do not build documentation for dependencies.
33 {{/option}}
34
35 {{#option "`--document-private-items`" }}
36 Include non-public items in the documentation. This will be enabled by default if documenting a binary target.
37 {{/option}}
38
39 {{/options}}
40
41 {{> section-package-selection }}
42
43 ### Target Selection
44
45 When no target selection options are given, `cargo doc` will document all
46 binary and library targets of the selected package. The binary will be skipped
47 if its name is the same as the lib target. Binaries are skipped if they have
48 `required-features` that are missing.
49
50 The default behavior can be changed by setting `doc = false` for the target in
51 the manifest settings. Using target selection options will ignore the `doc`
52 flag and will always document the given target.
53
54 {{#options}}
55 {{> options-targets-lib-bin }}
56
57 {{#option "`--example` _name_..." }}
58 {{actionverb}} the specified example. This flag may be specified multiple times
59 and supports common Unix glob patterns.
60 {{/option}}
61
62 {{#option "`--examples`" }}
63 {{actionverb}} all example targets.
64 {{/option}}
65
66 {{/options}}
67
68 {{> section-features }}
69
70 ### Compilation Options
71
72 {{#options}}
73
74 {{> options-target-triple }}
75
76 {{> options-release }}
77
78 {{> options-profile }}
79
80 {{> options-ignore-rust-version }}
81
82 {{> options-timings }}
83
84 {{/options}}
85
86 ### Output Options
87
88 {{#options}}
89 {{> options-target-dir }}
90 {{/options}}
91
92 ### Display Options
93
94 {{#options}}
95 {{> options-display }}
96
97 {{> options-message-format }}
98 {{/options}}
99
100 ### Manifest Options
101
102 {{#options}}
103 {{> options-manifest-path }}
104
105 {{> options-locked }}
106 {{/options}}
107
108 {{> section-options-common }}
109
110 ### Miscellaneous Options
111
112 {{#options}}
113 {{> options-jobs }}
114 {{> options-keep-going }}
115 {{/options}}
116
117 {{> section-environment }}
118
119 {{> section-exit-status }}
120
121 ## EXAMPLES
122
123 1. Build the local package documentation and its dependencies and output to
124 `target/doc`.
125
126 cargo doc
127
128 ## SEE ALSO
129 {{man "cargo" 1}}, {{man "cargo-rustdoc" 1}}, {{man "rustdoc" 1}}