1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
| {
/* 工作空间中所有包的数组。
除非使用 --no-deps,否则还包括所有启用了特性的依赖。
*/
"packages": [
{
/* 包的名称。 */
"name": "my-package",
/* 包的版本。 */
"version": "0.1.0",
/* 用于在文档内引用该包以及作为许多命令的 `--package` 参数的 Package ID。 */
"id": "file:///path/to/my-package#0.1.0",
/* 清单中的 license 值,或 null。 */
"license": "MIT/Apache-2.0",
/* 清单中的 license-file 值,或 null。 */
"license_file": "LICENSE",
/* 清单中的 description 值,或 null。 */
"description": "Package description.",
/* 包的 source ID,表示包来源的「不透明」标识符。稳定性保证见上文「兼容性」。
路径依赖与工作空间成员为 null。
对于其他依赖,它是如下格式的字符串:
- 基于注册表的依赖为 "registry+URL"。
示例:"registry+https://github.com/rust-lang/crates.io-index"
- 基于 git 的依赖为 "git+URL"。
示例:"git+https://github.com/rust-lang/cargo?rev=5e85ba14aaa20f8133863373404cb0af69eeef2c#5e85ba14aaa20f8133863373404cb0af69eeef2c"
- 来自 sparse 注册表的依赖为 "sparse+URL"。
示例:"sparse+https://my-sparse-registry.org"
`+` 之后的值没有明确定义,可能在 Cargo 版本之间变化,
且不一定与配置文件中的注册表定义等其他内容直接对应。
未来可能添加具有不同 `+` 前缀标识符的新来源种类。
*/
"source": null,
/* 包清单中声明的依赖数组。 */
"dependencies": [
{
/* 依赖的名称。 */
"name": "bitflags",
/* 依赖的 source ID。可能为 null,见包的 source 说明。 */
"source": "registry+https://github.com/rust-lang/crates.io-index",
/* 依赖的版本要求。
没有版本要求的依赖值为 "*"。
*/
"req": "^1.0",
/* 依赖种类。
"dev"、"build",或普通依赖为 null。
*/
"kind": null,
/* 若依赖被重命名,此为依赖的新名称字符串。未重命名则为 null。 */
"rename": null,
/* 是否为可选依赖的布尔值。 */
"optional": false,
/* 是否启用默认特性的布尔值。 */
"uses_default_features": true,
/* 已启用的特性数组。 */
"features": [],
/* 依赖的目标平台。
非目标依赖时为 null。
*/
"target": "cfg(windows)",
/* 本地路径依赖的文件系统路径。
非路径依赖时不存在。
*/
"path": "/path/to/dep",
/* 此依赖所属注册表 URL 的字符串。
未指定或为 null 时,依赖来自默认注册表(crates.io)。
*/
"registry": null,
/* (不稳定)是否为 public 依赖的布尔标志。
仅在启用 `-Zpublic-dependency` 时出现此字段。
*/
"public": false
}
],
/* Cargo 目标数组。 */
"targets": [
{
/* 目标种类数组。
- lib 目标列出清单中的 `crate-type` 值,如 "lib"、"rlib"、"dylib"、"proc-macro" 等(默认 ["lib"])
- binary 为 ["bin"]
- example 为 ["example"]
- 集成测试为 ["test"]
- benchmark 为 ["bench"]
- 构建脚本为 ["custom-build"]
*/
"kind": [
"bin"
],
/* crate 类型数组。
- lib 与 example 库列出清单中的 `crate-type` 值,如 "lib"、"rlib"、"dylib"、"proc-macro" 等(默认 ["lib"])
- 所有其他目标种类为 ["bin"]
*/
"crate_types": [
"bin"
],
/* 目标名称。
对于 lib 目标,连字符会替换为下划线。
*/
"name": "my-package",
/* 目标根源文件的绝对路径。 */
"src_path": "/path/to/my-package/src/main.rs",
/* 目标的 Rust edition。
默认为包的 edition。
*/
"edition": "2018",
/* 必需特性数组。
若未设置必需特性,则不包含此属性。
*/
"required-features": ["feat1"],
/* 该目标是否应由 `cargo doc` 生成文档。 */
"doc": true,
/* 该目标是否启用了 doc 测试,且目标与 doc 测试兼容。 */
"doctest": false,
/* 该目标是否应使用 `--test` 构建并运行。 */
"test": true
}
],
/* 为包定义的特性集合。
每个特性映射到它启用的特性或依赖数组。
*/
"features": {
"default": [
"feat1"
],
"feat1": [],
"feat2": []
},
/* 此包清单的绝对路径。 */
"manifest_path": "/path/to/my-package/Cargo.toml",
/* 包元数据。
未指定元数据时为 null。
*/
"metadata": {
"docs": {
"rs": {
"all-features": true
}
}
},
/* 此包可发布到的注册表列表。
为 null 表示发布不受限制,为空数组表示禁止发布。 */
"publish": [
"crates-io"
],
/* 清单中的作者数组。
未指定作者时为空数组。
*/
"authors": [
"Jane Doe <user@example.com>"
],
/* 清单中的类别数组。 */
"categories": [
"command-line-utilities"
],
/* 可选字符串,为 cargo run 默认选择的二进制文件。 */
"default_run": null,
/* 可选字符串,为最低支持的 rust 版本。 */
"rust_version": "1.56",
/* 清单中的关键词数组。 */
"keywords": [
"cli"
],
/* 清单中的 readme 值,未指定时为 null。 */
"readme": "README.md",
/* 清单中的 repository 值,未指定时为 null。 */
"repository": "https://github.com/rust-lang/cargo",
/* 清单中的 homepage 值,未指定时为 null。 */
"homepage": "https://rust-lang.org",
/* 清单中的 documentation 值,未指定时为 null。 */
"documentation": "https://doc.rust-lang.org/stable/std",
/* 包的默认 edition。
请注意,单个目标可能有不同的 edition。
*/
"edition": "2018",
/* 可选字符串,为包链接到的原生库名称。 */
"links": null,
}
],
/* 工作空间成员数组。
每项为包的 Package ID。
*/
"workspace_members": [
"file:///path/to/my-package#0.1.0",
],
/* 工作空间默认成员数组。
每项为包的 Package ID。
*/
"workspace_default_members": [
"file:///path/to/my-package#0.1.0",
],
// 整个工作空间的已解析依赖图。启用的特性基于「当前」包启用的特性。
// 未激活的可选依赖不会列出。
//
// 若指定 --no-deps,则为 null。
//
// 默认包含所有目标平台的所有依赖。
// 可用 --filter-platform 标志缩小到特定目标三元组。
"resolve": {
/* 依赖图中的节点数组。
每个节点是一个包。
*/
"nodes": [
{
/* 此节点的 Package ID。 */
"id": "file:///path/to/my-package#0.1.0",
/* 此包的依赖,Package ID 数组。 */
"dependencies": [
"https://github.com/rust-lang/crates.io-index#bitflags@1.0.4"
],
/* 此包的依赖。这是 "dependencies" 的替代形式,包含额外信息。
特别是,它处理重命名的依赖。
*/
"deps": [
{
/* 依赖库目标的名称。
若这是重命名依赖,则为新名称。
*/
"name": "bitflags",
/* 依赖的 Package ID。 */
"pkg": "https://github.com/rust-lang/crates.io-index#bitflags@1.0.4"
/* 依赖种类数组。Cargo 1.40 中添加。 */
"dep_kinds": [
{
/* 依赖种类。
"dev"、"build",或普通依赖为 null。
*/
"kind": null,
/* 依赖的目标平台。
非目标依赖时为 null。
*/
"target": "cfg(windows)"
}
]
}
],
/* 此包上启用的特性数组。 */
"features": [
"default"
]
}
],
/* 当前工作目录中的包(若未指定 --manifest-path)。
虚拟工作空间时为 null。否则为包的 Package ID。
*/
"root": "file:///path/to/my-package#0.1.0",
},
/* Cargo 放置输出的目标目录绝对路径。 */
"target_directory": "/path/to/my-package/target",
/* Cargo 放置中间构建产物的构建目录绝对路径。(不稳定) */
"build_directory": "/path/to/my-package/build-dir",
/* 此元数据结构的 schema 版本。
若做出不兼容变更,此值会改变。
*/
"version": 1,
/* 工作空间根的绝对路径。 */
"workspace_root": "/path/to/my-package"
/* 工作空间元数据。
未指定元数据时为 null。 */
"metadata": {
"docs": {
"rs": {
"all-features": true
}
}
}
}
|