Skip to content

Commit 543e381

Browse files
committed
Add a table of contents for the manifest.
Closes #5822
1 parent dc81356 commit 543e381

File tree

1 file changed

+76
-31
lines changed

1 file changed

+76
-31
lines changed

src/doc/src/reference/manifest.md

Lines changed: 76 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,52 @@
11
## The Manifest Format
22

33
The `Cargo.toml` file for each package is called its *manifest*. Every manifest
4-
file consists of one or more sections.
4+
file consists of the following sections:
5+
6+
* [`cargo-features`](unstable.md) — Unstable, nightly-only features.
7+
* [`[package]`](#the-package-section) — Defines a package.
8+
* [`name`](#the-name-field) — The name of the package.
9+
* [`version`](#the-version-field) — The version of the package.
10+
* [`authors`](#the-authors-field) — The authors of the package.
11+
* [`edition`](#the-edition-field) — The Rust edition.
12+
* [`description`](#the-description-field) — A description of the package.
13+
* [`documentation`](#the-documentation-field) — URL of the package documentation.
14+
* [`readme`](#the-readme-field) — Path to the package's README file.
15+
* [`homepage`](#the-homepage-field) — URL of the package homepage.
16+
* [`repository`](#the-repository-field) — URL of the package source repository.
17+
* [`license`](#the-license-and-license-file-fields) — The package license.
18+
* [`license-file`](#the-license-and-license-file-fields) — Path to the text of the license.
19+
* [`keywords`](#the-keywords-field) — Keywords for the package.
20+
* [`categories`](#the-categories-field) — Categories of the package.
21+
* [`workspace`](#the-workspace-field) — Path to the workspace for the package.
22+
* [`build`](#the-build-field) — Path to the package build script.
23+
* [`links`](#the-links-field) — Name of the native library the package links with.
24+
* [`exclude`](#the-exclude-and-include-fields) — Files to exclude when publishing.
25+
* [`include`](#the-exclude-and-include-fields) — Files to include when publishing.
26+
* [`publish`](#the-publish-field) — Can be used to prevent publishing the package.
27+
* [`metadata`](#the-metadata-table) — Extra settings for external tools.
28+
* [`default-run`](#the-default-run-field) — The default binary to run by [`cargo run`].
29+
* [`autobins`](cargo-targets.md#target-auto-discovery) — Disables binary auto discovery.
30+
* [`autoexamples`](cargo-targets.md#target-auto-discovery) — Disables example auto discovery.
31+
* [`autotests`](cargo-targets.md#target-auto-discovery) — Disables test auto discovery.
32+
* [`autobenches`](cargo-targets.md#target-auto-discovery) — Disables bench auto discovery.
33+
* Target tables: (see [configuration](cargo-targets.md#configuring-a-target) for settings)
34+
* [`[lib]`](cargo-targets.md#library) — Library target settings.
35+
* [`[[bin]]`](cargo-targets.md#binaries) — Binary target settings.
36+
* [`[[example]]`](cargo-targets.md#examples) — Example target settings.
37+
* [`[[test]]`](cargo-targets.md#tests) — Test target settings.
38+
* [`[[bench]]`](cargo-targets.md#benchmarks) — Benchmark target settings.
39+
* Dependency tables:
40+
* [`[dependencies]`](specifying-dependencies.md) — Package library dependencies.
41+
* [`[dev-dependencies]`](specifying-dependencies.md#development-dependencies) — Dependencies for examples, tests, and benchmarks.
42+
* [`[build-dependencies]`](specifying-dependencies.md#build-dependencies) — Dependencies for build scripts.
43+
* [`[target]`](specifying-dependencies.md#platform-specific-dependencies) — Platform-specific dependencies.
44+
* [`[badges]`](#the-badges-section) — Badges to display on [crates.io].
45+
* [`[features]`](features.md) — Conditional compilation features.
46+
* [`[patch]`](#the-patch-section) — Override dependencies.
47+
* [`[replace]`](#the-replace-section) — Override dependencies (deprecated).
48+
* [`[profile]`](profiles.md) — Compiler settings and optimizations.
49+
* [`[workspace]`](workspaces.md) — The workspace definition.
550

651
<a id="package-metadata"></a>
752
### The `[package]` section
@@ -351,6 +396,36 @@ allowed to be published to.
351396
publish = ["some-registry-name"]
352397
```
353398

399+
#### The `metadata` table
400+
401+
Cargo by default will warn about unused keys in `Cargo.toml` to assist in
402+
detecting typos and such. The `package.metadata` table, however, is completely
403+
ignored by Cargo and will not be warned about. This section can be used for
404+
tools which would like to store package configuration in `Cargo.toml`. For
405+
example:
406+
407+
```toml
408+
[package]
409+
name = "..."
410+
# ...
411+
412+
# Metadata used when generating an Android APK, for example.
413+
[package.metadata.android]
414+
package-name = "my-awesome-android-app"
415+
assets = "path/to/static"
416+
```
417+
418+
#### The `default-run` field
419+
420+
The `default-run` field in the `[package]` section of the manifest can be used
421+
to specify a default binary picked by [`cargo run`]. For example, when there is
422+
both `src/bin/a.rs` and `src/bin/b.rs`:
423+
424+
```toml
425+
[package]
426+
default-run = "a"
427+
```
428+
354429
### The `[badges]` section
355430

356431
[crates.io] can display various badges for build status, test coverage, etc. for
@@ -430,36 +505,6 @@ is-it-maintained-open-issues = { repository = "..." }
430505
maintenance = { status = "..." }
431506
```
432507

433-
#### The `metadata` table
434-
435-
Cargo by default will warn about unused keys in `Cargo.toml` to assist in
436-
detecting typos and such. The `package.metadata` table, however, is completely
437-
ignored by Cargo and will not be warned about. This section can be used for
438-
tools which would like to store package configuration in `Cargo.toml`. For
439-
example:
440-
441-
```toml
442-
[package]
443-
name = "..."
444-
# ...
445-
446-
# Metadata used when generating an Android APK, for example.
447-
[package.metadata.android]
448-
package-name = "my-awesome-android-app"
449-
assets = "path/to/static"
450-
```
451-
452-
#### The `default-run` field
453-
454-
The `default-run` field in the `[package]` section of the manifest can be used
455-
to specify a default binary picked by [`cargo run`]. For example, when there is
456-
both `src/bin/a.rs` and `src/bin/b.rs`:
457-
458-
```toml
459-
[package]
460-
default-run = "a"
461-
```
462-
463508
### Dependency sections
464509

465510
See the [specifying dependencies page](specifying-dependencies.md) for

0 commit comments

Comments
 (0)