Skip to content

Commit 39027ba

Browse files
committed
docs(metadata): Stabilize id format as PackageIDSpec
This makes it so you can take a package from `cargo metadata` and then pass it with the `--package` option without worrying about ambiguity. Fixes #7267
1 parent 6176ccd commit 39027ba

File tree

4 files changed

+37
-15
lines changed

4 files changed

+37
-15
lines changed

src/doc/man/cargo-metadata.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ considersed as incompatible:
3434
* **Adding new values for enum-like fields** — Same as adding new fields. It
3535
keeps metadata evolving without stagnation.
3636
* **Changing opaque representations** — The inner representations of some
37-
fields are implementation details. For example, fields related to "Package ID"
38-
or "Source ID" are treated as opaque identifiers to differentiate packages or
37+
fields are implementation details. For example, fields related to
38+
"Source ID" are treated as opaque identifiers to differentiate packages or
3939
sources. Consumers shouldn't rely on those representations unless specified.
4040

4141
### JSON format
@@ -53,8 +53,8 @@ The JSON output has the following format:
5353
"name": "my-package",
5454
/* The version of the package. */
5555
"version": "0.1.0",
56-
/* The Package ID, an opaque and unique identifier for referring to the
57-
package. See "Compatibility" above for the stability guarantee.
56+
/* The Package ID for referring to the
57+
package within the document and as the `--package` argument to many commands
5858
*/
5959
"id": "file:///path/to/my-package#0.1.0",
6060
/* The license value from the manifest, or null. */
@@ -331,6 +331,11 @@ The JSON output has the following format:
331331
}
332332
````
333333

334+
Notes:
335+
- For `"id"` field syntax, see [Package ID Specifications] in the reference.
336+
337+
[Package ID Specifications]: ../reference/pkgid-spec.html
338+
334339
## OPTIONS
335340

336341
### Output Options

src/doc/man/generated_txt/cargo-metadata.txt

+11-5
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ OUTPUT FORMAT
3232

3333
o Changing opaque representations — The inner representations of some
3434
fields are implementation details. For example, fields related to
35-
Package ID” or “Source ID” are treated as opaque identifiers
36-
to differentiate packages or sources. Consumers shouldn’t rely on
37-
those representations unless specified.
35+
“Source ID” are treated as opaque identifiers to differentiate
36+
packages or sources. Consumers shouldn’t rely on those
37+
representations unless specified.
3838

3939
JSON format
4040
The JSON output has the following format:
@@ -49,8 +49,8 @@ OUTPUT FORMAT
4949
"name": "my-package",
5050
/* The version of the package. */
5151
"version": "0.1.0",
52-
/* The Package ID, an opaque and unique identifier for referring to the
53-
package. See "Compatibility" above for the stability guarantee.
52+
/* The Package ID for referring to the
53+
package within the document and as the `--package` argument to many commands
5454
*/
5555
"id": "file:///path/to/my-package#0.1.0",
5656
/* The license value from the manifest, or null. */
@@ -326,6 +326,12 @@ OUTPUT FORMAT
326326
}
327327
}
328328

329+
Notes:
330+
331+
o For "id" field syntax, see Package ID Specifications
332+
<https://doc.rust-lang.org/cargo/reference/pkgid-spec.html> in the
333+
reference.
334+
329335
OPTIONS
330336
Output Options
331337
--no-deps

src/doc/src/commands/cargo-metadata.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ considersed as incompatible:
3434
* **Adding new values for enum-like fields** — Same as adding new fields. It
3535
keeps metadata evolving without stagnation.
3636
* **Changing opaque representations** — The inner representations of some
37-
fields are implementation details. For example, fields related to "Package ID"
38-
or "Source ID" are treated as opaque identifiers to differentiate packages or
37+
fields are implementation details. For example, fields related to
38+
"Source ID" are treated as opaque identifiers to differentiate packages or
3939
sources. Consumers shouldn't rely on those representations unless specified.
4040

4141
### JSON format
@@ -53,8 +53,8 @@ The JSON output has the following format:
5353
"name": "my-package",
5454
/* The version of the package. */
5555
"version": "0.1.0",
56-
/* The Package ID, an opaque and unique identifier for referring to the
57-
package. See "Compatibility" above for the stability guarantee.
56+
/* The Package ID for referring to the
57+
package within the document and as the `--package` argument to many commands
5858
*/
5959
"id": "file:///path/to/my-package#0.1.0",
6060
/* The license value from the manifest, or null. */
@@ -331,6 +331,11 @@ The JSON output has the following format:
331331
}
332332
````
333333

334+
Notes:
335+
- For `"id"` field syntax, see [Package ID Specifications] in the reference.
336+
337+
[Package ID Specifications]: ../reference/pkgid-spec.html
338+
334339
## OPTIONS
335340

336341
### Output Options

src/etc/man/cargo-metadata.1

+8-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ keeps metadata evolving without stagnation.
3636
.sp
3737
.RS 4
3838
\h'-04'\(bu\h'+02'\fBChanging opaque representations\fR \[em] The inner representations of some
39-
fields are implementation details. For example, fields related to \[lq]Package ID\[rq]
40-
or \[lq]Source ID\[rq] are treated as opaque identifiers to differentiate packages or
39+
fields are implementation details. For example, fields related to
40+
\[lq]Source ID\[rq] are treated as opaque identifiers to differentiate packages or
4141
sources. Consumers shouldn\[cq]t rely on those representations unless specified.
4242
.RE
4343
.SS "JSON format"
@@ -333,6 +333,12 @@ The JSON output has the following format:
333333
}
334334
.fi
335335
.RE
336+
.sp
337+
Notes:
338+
.sp
339+
.RS 4
340+
\h'-04'\(bu\h'+02'For \fB"id"\fR field syntax, see \fIPackage ID Specifications\fR <https://doc.rust\-lang.org/cargo/reference/pkgid\-spec.html> in the reference.
341+
.RE
336342
.SH "OPTIONS"
337343
.SS "Output Options"
338344
.sp

0 commit comments

Comments
 (0)