Jeff Vander Stoep | 956d143 | 2020-09-18 13:46:24 +0200 | [diff] [blame] | 1 | '\" t |
| 2 | .\" Title: cargo-rustdoc |
| 3 | .\" Author: [see the "AUTHOR(S)" section] |
| 4 | .\" Generator: Asciidoctor 2.0.10 |
| 5 | .\" Date: 2020-06-25 |
| 6 | .\" Manual: \ \& |
| 7 | .\" Source: \ \& |
| 8 | .\" Language: English |
| 9 | .\" |
| 10 | .TH "CARGO\-RUSTDOC" "1" "2020-06-25" "\ \&" "\ \&" |
| 11 | .ie \n(.g .ds Aq \(aq |
| 12 | .el .ds Aq ' |
| 13 | .ss \n[.ss] 0 |
| 14 | .nh |
| 15 | .ad l |
| 16 | .de URL |
| 17 | \fI\\$2\fP <\\$1>\\$3 |
| 18 | .. |
| 19 | .als MTO URL |
| 20 | .if \n[.g] \{\ |
| 21 | . mso www.tmac |
| 22 | . am URL |
| 23 | . ad l |
| 24 | . . |
| 25 | . am MTO |
| 26 | . ad l |
| 27 | . . |
| 28 | . LINKSTYLE blue R < > |
| 29 | .\} |
| 30 | .SH "NAME" |
| 31 | cargo\-rustdoc \- Build a package\(aqs documentation, using specified custom flags |
| 32 | .SH "SYNOPSIS" |
| 33 | .sp |
| 34 | \fBcargo rustdoc [\fIOPTIONS\fP] [\-\- \fIARGS\fP]\fP |
| 35 | .SH "DESCRIPTION" |
| 36 | .sp |
| 37 | The specified target for the current package (or package specified by \fB\-p\fP if |
| 38 | provided) will be documented with the specified \fIARGS\fP being passed to the |
| 39 | final rustdoc invocation. Dependencies will not be documented as part of this |
| 40 | command. Note that rustdoc will still unconditionally receive arguments such |
| 41 | as \fB\-L\fP, \fB\-\-extern\fP, and \fB\-\-crate\-type\fP, and the specified \fIARGS\fP will simply |
| 42 | be added to the rustdoc invocation. |
| 43 | .sp |
| 44 | See \c |
| 45 | .URL "https://doc.rust\-lang.org/rustdoc/index.html" "" " " |
| 46 | for documentation on rustdoc |
| 47 | flags. |
| 48 | .sp |
| 49 | This command requires that only one target is being compiled when additional |
| 50 | arguments are provided. If more than one target is available for the current |
| 51 | package the filters of \fB\-\-lib\fP, \fB\-\-bin\fP, etc, must be used to select which |
| 52 | target is compiled. |
| 53 | To pass flags to all rustdoc processes spawned by Cargo, use the |
| 54 | \fBRUSTDOCFLAGS\fP \c |
| 55 | .URL "https://doc.rust\-lang.org/cargo/reference/environment\-variables.html" "environment variable" |
| 56 | or the \fBbuild.rustdocflags\fP \c |
| 57 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 58 | .SH "OPTIONS" |
| 59 | .SS "Documentation Options" |
| 60 | .sp |
| 61 | \fB\-\-open\fP |
| 62 | .RS 4 |
| 63 | Open the docs in a browser after building them. This will use your default |
| 64 | browser unless you define another one in the \fBBROWSER\fP environment |
| 65 | variable. |
| 66 | .RE |
| 67 | .SS "Package Selection" |
| 68 | .sp |
| 69 | By default, the package in the current working directory is selected. The \fB\-p\fP |
| 70 | flag can be used to choose a different package in a workspace. |
| 71 | .sp |
| 72 | \fB\-p\fP \fISPEC\fP, \fB\-\-package\fP \fISPEC\fP |
| 73 | .RS 4 |
| 74 | The package to document. See \fBcargo\-pkgid\fP(1) for |
| 75 | the SPEC format. |
| 76 | .RE |
| 77 | .SS "Target Selection" |
| 78 | .sp |
| 79 | When no target selection options are given, \fBcargo rustdoc\fP will document all |
| 80 | binary and library targets of the selected package. The binary will be skipped |
| 81 | if its name is the same as the lib target. Binaries are skipped if they have |
| 82 | \fBrequired\-features\fP that are missing. |
| 83 | .sp |
| 84 | Passing target selection flags will document only the |
| 85 | specified targets. |
| 86 | .sp |
| 87 | \fB\-\-lib\fP |
| 88 | .RS 4 |
| 89 | Document the package\(cqs library. |
| 90 | .RE |
| 91 | .sp |
| 92 | \fB\-\-bin\fP \fINAME\fP... |
| 93 | .RS 4 |
| 94 | Document the specified binary. This flag may be specified multiple times. |
| 95 | .RE |
| 96 | .sp |
| 97 | \fB\-\-bins\fP |
| 98 | .RS 4 |
| 99 | Document all binary targets. |
| 100 | .RE |
| 101 | .sp |
| 102 | \fB\-\-example\fP \fINAME\fP... |
| 103 | .RS 4 |
| 104 | Document the specified example. This flag may be specified multiple times. |
| 105 | .RE |
| 106 | .sp |
| 107 | \fB\-\-examples\fP |
| 108 | .RS 4 |
| 109 | Document all example targets. |
| 110 | .RE |
| 111 | .sp |
| 112 | \fB\-\-test\fP \fINAME\fP... |
| 113 | .RS 4 |
| 114 | Document the specified integration test. This flag may be specified multiple |
| 115 | times. |
| 116 | .RE |
| 117 | .sp |
| 118 | \fB\-\-tests\fP |
| 119 | .RS 4 |
| 120 | Document all targets in test mode that have the \fBtest = true\fP manifest |
| 121 | flag set. By default this includes the library and binaries built as |
| 122 | unittests, and integration tests. Be aware that this will also build any |
| 123 | required dependencies, so the lib target may be built twice (once as a |
| 124 | unittest, and once as a dependency for binaries, integration tests, etc.). |
| 125 | Targets may be enabled or disabled by setting the \fBtest\fP flag in the |
| 126 | manifest settings for the target. |
| 127 | .RE |
| 128 | .sp |
| 129 | \fB\-\-bench\fP \fINAME\fP... |
| 130 | .RS 4 |
| 131 | Document the specified benchmark. This flag may be specified multiple times. |
| 132 | .RE |
| 133 | .sp |
| 134 | \fB\-\-benches\fP |
| 135 | .RS 4 |
| 136 | Document all targets in benchmark mode that have the \fBbench = true\fP |
| 137 | manifest flag set. By default this includes the library and binaries built |
| 138 | as benchmarks, and bench targets. Be aware that this will also build any |
| 139 | required dependencies, so the lib target may be built twice (once as a |
| 140 | benchmark, and once as a dependency for binaries, benchmarks, etc.). |
| 141 | Targets may be enabled or disabled by setting the \fBbench\fP flag in the |
| 142 | manifest settings for the target. |
| 143 | .RE |
| 144 | .sp |
| 145 | \fB\-\-all\-targets\fP |
| 146 | .RS 4 |
| 147 | Document all targets. This is equivalent to specifying \fB\-\-lib \-\-bins |
| 148 | \-\-tests \-\-benches \-\-examples\fP. |
| 149 | .RE |
| 150 | .SS "Feature Selection" |
| 151 | .sp |
| 152 | The feature flags allow you to control the enabled features for the "current" |
| 153 | package. The "current" package is the package in the current directory, or the |
| 154 | one specified in \fB\-\-manifest\-path\fP. If running in the root of a virtual |
| 155 | workspace, then the default features are selected for all workspace members, |
| 156 | or all features if \fB\-\-all\-features\fP is specified. |
| 157 | .sp |
| 158 | When no feature options are given, the \fBdefault\fP feature is activated for |
| 159 | every selected package. |
| 160 | .sp |
| 161 | \fB\-\-features\fP \fIFEATURES\fP |
| 162 | .RS 4 |
| 163 | Space or comma separated list of features to activate. These features only |
| 164 | apply to the current directory\(cqs package. Features of direct dependencies |
| 165 | may be enabled with \fB<dep\-name>/<feature\-name>\fP syntax. This flag may be |
| 166 | specified multiple times, which enables all specified features. |
| 167 | .RE |
| 168 | .sp |
| 169 | \fB\-\-all\-features\fP |
| 170 | .RS 4 |
| 171 | Activate all available features of all selected packages. |
| 172 | .RE |
| 173 | .sp |
| 174 | \fB\-\-no\-default\-features\fP |
| 175 | .RS 4 |
| 176 | Do not activate the \fBdefault\fP feature of the current directory\(cqs |
| 177 | package. |
| 178 | .RE |
| 179 | .SS "Compilation Options" |
| 180 | .sp |
| 181 | \fB\-\-target\fP \fITRIPLE\fP |
| 182 | .RS 4 |
| 183 | Document for the given architecture. The default is the host |
| 184 | architecture. The general format of the triple is |
| 185 | \fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fP. Run \fBrustc \-\-print target\-list\fP for a |
| 186 | list of supported targets. |
| 187 | .sp |
| 188 | This may also be specified with the \fBbuild.target\fP |
| 189 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 190 | .sp |
| 191 | Note that specifying this flag makes Cargo run in a different mode where the |
| 192 | target artifacts are placed in a separate directory. See the |
| 193 | .URL "https://doc.rust\-lang.org/cargo/guide/build\-cache.html" "build cache" " " |
| 194 | documentation for more details. |
| 195 | .RE |
| 196 | .sp |
| 197 | \fB\-\-release\fP |
| 198 | .RS 4 |
| 199 | Document optimized artifacts with the \fBrelease\fP profile. See the |
| 200 | PROFILES section for details on how this affects profile selection. |
| 201 | .RE |
| 202 | .SS "Output Options" |
| 203 | .sp |
| 204 | \fB\-\-target\-dir\fP \fIDIRECTORY\fP |
| 205 | .RS 4 |
| 206 | Directory for all generated artifacts and intermediate files. May also be |
| 207 | specified with the \fBCARGO_TARGET_DIR\fP environment variable, or the |
| 208 | \fBbuild.target\-dir\fP \c |
| 209 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 210 | Defaults |
| 211 | to \fBtarget\fP in the root of the workspace. |
| 212 | .RE |
| 213 | .SS "Display Options" |
| 214 | .sp |
| 215 | \fB\-v\fP, \fB\-\-verbose\fP |
| 216 | .RS 4 |
| 217 | Use verbose output. May be specified twice for "very verbose" output which |
| 218 | includes extra output such as dependency warnings and build script output. |
| 219 | May also be specified with the \fBterm.verbose\fP |
| 220 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 221 | .RE |
| 222 | .sp |
| 223 | \fB\-q\fP, \fB\-\-quiet\fP |
| 224 | .RS 4 |
| 225 | No output printed to stdout. |
| 226 | .RE |
| 227 | .sp |
| 228 | \fB\-\-color\fP \fIWHEN\fP |
| 229 | .RS 4 |
| 230 | Control when colored output is used. Valid values: |
| 231 | .sp |
| 232 | .RS 4 |
| 233 | .ie n \{\ |
| 234 | \h'-04'\(bu\h'+03'\c |
| 235 | .\} |
| 236 | .el \{\ |
| 237 | . sp -1 |
| 238 | . IP \(bu 2.3 |
| 239 | .\} |
| 240 | \fBauto\fP (default): Automatically detect if color support is available on the |
| 241 | terminal. |
| 242 | .RE |
| 243 | .sp |
| 244 | .RS 4 |
| 245 | .ie n \{\ |
| 246 | \h'-04'\(bu\h'+03'\c |
| 247 | .\} |
| 248 | .el \{\ |
| 249 | . sp -1 |
| 250 | . IP \(bu 2.3 |
| 251 | .\} |
| 252 | \fBalways\fP: Always display colors. |
| 253 | .RE |
| 254 | .sp |
| 255 | .RS 4 |
| 256 | .ie n \{\ |
| 257 | \h'-04'\(bu\h'+03'\c |
| 258 | .\} |
| 259 | .el \{\ |
| 260 | . sp -1 |
| 261 | . IP \(bu 2.3 |
| 262 | .\} |
| 263 | \fBnever\fP: Never display colors. |
| 264 | .RE |
| 265 | .sp |
| 266 | May also be specified with the \fBterm.color\fP |
| 267 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 268 | .RE |
| 269 | .sp |
| 270 | \fB\-\-message\-format\fP \fIFMT\fP |
| 271 | .RS 4 |
| 272 | The output format for diagnostic messages. Can be specified multiple times |
| 273 | and consists of comma\-separated values. Valid values: |
| 274 | .sp |
| 275 | .RS 4 |
| 276 | .ie n \{\ |
| 277 | \h'-04'\(bu\h'+03'\c |
| 278 | .\} |
| 279 | .el \{\ |
| 280 | . sp -1 |
| 281 | . IP \(bu 2.3 |
| 282 | .\} |
| 283 | \fBhuman\fP (default): Display in a human\-readable text format. |
| 284 | .RE |
| 285 | .sp |
| 286 | .RS 4 |
| 287 | .ie n \{\ |
| 288 | \h'-04'\(bu\h'+03'\c |
| 289 | .\} |
| 290 | .el \{\ |
| 291 | . sp -1 |
| 292 | . IP \(bu 2.3 |
| 293 | .\} |
| 294 | \fBshort\fP: Emit shorter, human\-readable text messages. |
| 295 | .RE |
| 296 | .sp |
| 297 | .RS 4 |
| 298 | .ie n \{\ |
| 299 | \h'-04'\(bu\h'+03'\c |
| 300 | .\} |
| 301 | .el \{\ |
| 302 | . sp -1 |
| 303 | . IP \(bu 2.3 |
| 304 | .\} |
| 305 | \fBjson\fP: Emit JSON messages to stdout. See |
| 306 | \c |
| 307 | .URL "https://doc.rust\-lang.org/cargo/reference/external\-tools.html#json\-messages" "the reference" |
| 308 | for more details. |
| 309 | .RE |
| 310 | .sp |
| 311 | .RS 4 |
| 312 | .ie n \{\ |
| 313 | \h'-04'\(bu\h'+03'\c |
| 314 | .\} |
| 315 | .el \{\ |
| 316 | . sp -1 |
| 317 | . IP \(bu 2.3 |
| 318 | .\} |
| 319 | \fBjson\-diagnostic\-short\fP: Ensure the \fBrendered\fP field of JSON messages contains |
| 320 | the "short" rendering from rustc. |
| 321 | .RE |
| 322 | .sp |
| 323 | .RS 4 |
| 324 | .ie n \{\ |
| 325 | \h'-04'\(bu\h'+03'\c |
| 326 | .\} |
| 327 | .el \{\ |
| 328 | . sp -1 |
| 329 | . IP \(bu 2.3 |
| 330 | .\} |
| 331 | \fBjson\-diagnostic\-rendered\-ansi\fP: Ensure the \fBrendered\fP field of JSON messages |
| 332 | contains embedded ANSI color codes for respecting rustc\(cqs default color |
| 333 | scheme. |
| 334 | .RE |
| 335 | .sp |
| 336 | .RS 4 |
| 337 | .ie n \{\ |
| 338 | \h'-04'\(bu\h'+03'\c |
| 339 | .\} |
| 340 | .el \{\ |
| 341 | . sp -1 |
| 342 | . IP \(bu 2.3 |
| 343 | .\} |
| 344 | \fBjson\-render\-diagnostics\fP: Instruct Cargo to not include rustc diagnostics in |
| 345 | in JSON messages printed, but instead Cargo itself should render the |
| 346 | JSON diagnostics coming from rustc. Cargo\(cqs own JSON diagnostics and others |
| 347 | coming from rustc are still emitted. |
| 348 | .RE |
| 349 | .RE |
| 350 | .SS "Manifest Options" |
| 351 | .sp |
| 352 | \fB\-\-manifest\-path\fP \fIPATH\fP |
| 353 | .RS 4 |
| 354 | Path to the \fBCargo.toml\fP file. By default, Cargo searches for the |
| 355 | \fBCargo.toml\fP file in the current directory or any parent directory. |
| 356 | .RE |
| 357 | .sp |
| 358 | \fB\-\-frozen\fP, \fB\-\-locked\fP |
| 359 | .RS 4 |
| 360 | Either of these flags requires that the \fBCargo.lock\fP file is |
| 361 | up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will |
| 362 | exit with an error. The \fB\-\-frozen\fP flag also prevents Cargo from |
| 363 | attempting to access the network to determine if it is out\-of\-date. |
| 364 | .sp |
| 365 | These may be used in environments where you want to assert that the |
| 366 | \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network |
| 367 | access. |
| 368 | .RE |
| 369 | .sp |
| 370 | \fB\-\-offline\fP |
| 371 | .RS 4 |
| 372 | Prevents Cargo from accessing the network for any reason. Without this |
| 373 | flag, Cargo will stop with an error if it needs to access the network and |
| 374 | the network is not available. With this flag, Cargo will attempt to |
| 375 | proceed without the network if possible. |
| 376 | .sp |
| 377 | Beware that this may result in different dependency resolution than online |
| 378 | mode. Cargo will restrict itself to crates that are downloaded locally, even |
| 379 | if there might be a newer version as indicated in the local copy of the index. |
| 380 | See the \fBcargo\-fetch\fP(1) command to download dependencies before going |
| 381 | offline. |
| 382 | .sp |
| 383 | May also be specified with the \fBnet.offline\fP \c |
| 384 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 385 | .RE |
| 386 | .SS "Common Options" |
| 387 | .sp |
| 388 | \fB+TOOLCHAIN\fP |
| 389 | .RS 4 |
| 390 | If Cargo has been installed with rustup, and the first argument to \fBcargo\fP |
| 391 | begins with \fB+\fP, it will be interpreted as a rustup toolchain name (such |
| 392 | as \fB+stable\fP or \fB+nightly\fP). |
| 393 | See the \c |
| 394 | .URL "https://github.com/rust\-lang/rustup/" "rustup documentation" |
| 395 | for more information about how toolchain overrides work. |
| 396 | .RE |
| 397 | .sp |
| 398 | \fB\-h\fP, \fB\-\-help\fP |
| 399 | .RS 4 |
| 400 | Prints help information. |
| 401 | .RE |
| 402 | .sp |
| 403 | \fB\-Z\fP \fIFLAG\fP... |
| 404 | .RS 4 |
| 405 | Unstable (nightly\-only) flags to Cargo. Run \fBcargo \-Z help\fP for |
| 406 | details. |
| 407 | .RE |
| 408 | .SS "Miscellaneous Options" |
| 409 | .sp |
| 410 | \fB\-j\fP \fIN\fP, \fB\-\-jobs\fP \fIN\fP |
| 411 | .RS 4 |
| 412 | Number of parallel jobs to run. May also be specified with the |
| 413 | \fBbuild.jobs\fP \c |
| 414 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 415 | Defaults to |
| 416 | the number of CPUs. |
| 417 | .RE |
| 418 | .SH "PROFILES" |
| 419 | .sp |
| 420 | Profiles may be used to configure compiler options such as optimization levels |
| 421 | and debug settings. See |
| 422 | \c |
| 423 | .URL "https://doc.rust\-lang.org/cargo/reference/profiles.html" "the reference" |
| 424 | for more details. |
| 425 | .sp |
| 426 | Profile selection depends on the target and crate being built. By default the |
| 427 | \fBdev\fP or \fBtest\fP profiles are used. If the \fB\-\-release\fP flag is given, then the |
| 428 | \fBrelease\fP or \fBbench\fP profiles are used. |
| 429 | .TS |
| 430 | allbox tab(:); |
| 431 | lt lt lt. |
| 432 | T{ |
| 433 | .sp |
| 434 | Target |
| 435 | T}:T{ |
| 436 | .sp |
| 437 | Default Profile |
| 438 | T}:T{ |
| 439 | .sp |
| 440 | \fB\-\-release\fP Profile |
| 441 | T} |
| 442 | T{ |
| 443 | .sp |
| 444 | lib, bin, example |
| 445 | T}:T{ |
| 446 | .sp |
| 447 | \fBdev\fP |
| 448 | T}:T{ |
| 449 | .sp |
| 450 | \fBrelease\fP |
| 451 | T} |
| 452 | T{ |
| 453 | .sp |
| 454 | test, bench, or any target |
| 455 | .br |
| 456 | in "test" or "bench" mode |
| 457 | T}:T{ |
| 458 | .sp |
| 459 | \fBtest\fP |
| 460 | T}:T{ |
| 461 | .sp |
| 462 | \fBbench\fP |
| 463 | T} |
| 464 | .TE |
| 465 | .sp |
| 466 | .sp |
| 467 | Dependencies use the \fBdev\fP/\fBrelease\fP profiles. |
| 468 | .SH "ENVIRONMENT" |
| 469 | .sp |
| 470 | See \c |
| 471 | .URL "https://doc.rust\-lang.org/cargo/reference/environment\-variables.html" "the reference" " " |
| 472 | for |
| 473 | details on environment variables that Cargo reads. |
| 474 | .SH "EXIT STATUS" |
| 475 | .sp |
| 476 | 0 |
| 477 | .RS 4 |
| 478 | Cargo succeeded. |
| 479 | .RE |
| 480 | .sp |
| 481 | 101 |
| 482 | .RS 4 |
| 483 | Cargo failed to complete. |
| 484 | .RE |
| 485 | .SH "EXAMPLES" |
| 486 | .sp |
| 487 | .RS 4 |
| 488 | .ie n \{\ |
| 489 | \h'-04' 1.\h'+01'\c |
| 490 | .\} |
| 491 | .el \{\ |
| 492 | . sp -1 |
| 493 | . IP " 1." 4.2 |
| 494 | .\} |
| 495 | Build documentation with custom CSS included from a given file: |
| 496 | .sp |
| 497 | .if n .RS 4 |
| 498 | .nf |
| 499 | cargo rustdoc \-\-lib \-\- \-\-extend\-css extra.css |
| 500 | .fi |
| 501 | .if n .RE |
| 502 | .RE |
| 503 | .SH "SEE ALSO" |
| 504 | .sp |
| 505 | \fBcargo\fP(1), \fBcargo\-doc\fP(1), \fBrustdoc\fP(1) |