Skip to content

Commit 5571b39

Browse files
committed
Tweaks based on implementation
1 parent a648bb5 commit 5571b39

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

text/0000-rustdoc-json.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ After running the above command, you should get a `lib.json` file like the follo
8484
"includes_private": false,
8585
"index": {
8686
"0:3": {
87-
"crate_num": 0,
87+
"crate_id": 0,
8888
"name": "some_fn",
8989
"source": {
9090
"filename": "lib.rs",
@@ -107,7 +107,7 @@ After running the above command, you should get a `lib.json` file like the follo
107107
}
108108
},
109109
"0:4": {
110-
"crate_num": 0,
110+
"crate_id": 0,
111111
"name": "SomeStruct",
112112
"source": {
113113
"filename": "lib.rs",
@@ -127,7 +127,7 @@ After running the above command, you should get a `lib.json` file like the follo
127127
}
128128
},
129129
"0:0": {
130-
"crate_num": 0,
130+
"crate_id": 0,
131131
"name": "lib",
132132
"source": {
133133
"filename": "lib.rs",
@@ -149,12 +149,12 @@ After running the above command, you should get a `lib.json` file like the follo
149149
},
150150
"paths": {
151151
"0:3": {
152-
"crate_num": 0,
152+
"crate_id": 0,
153153
"path": ["lib", "some_fn"],
154154
"kind": "function"
155155
},
156156
"0:4": {
157-
"crate_num": 0,
157+
"crate_id": 0,
158158
"path": ["lib", "SomeStruct"],
159159
"kind": "struct"
160160
},
@@ -241,7 +241,7 @@ Name | Type | Description
241241

242242
Name | Type | Description
243243
----------|---------|------------------------------------------------------------------------------
244-
`crate_num` | int | A number corresponding to the crate this Item is from. Used as an key to the `extern_crates` map in [Crate](#Crate). A value of zero represents an Item from the local crate, any other number means that this Item is external.
244+
`crate_id` | int | A number corresponding to the crate this Item is from. Used as an key to the `extern_crates` map in [Crate](#Crate). A value of zero represents an Item from the local crate, any other number means that this Item is external.
245245
`path` | [String] | The fully qualified path (e.g. `["std", "io", "lazy", "Lazy"]` for `std::io::lazy::Lazy`) of this Item.
246246
`kind` | String | What type of Item this is (see [Item](#Item)).
247247

@@ -253,18 +253,27 @@ and leaves kind-specific details (like function args or enum variants) to the `i
253253

254254
Name | Type | Description
255255
----------|---------|------------------------------------------------------------------------------
256-
`crate_num` | int | A number corresponding to the crate this Item is from. Used as an key to the `extern_crates` map in [Crate](#Crate). A value of zero represents an Item from the local crate, any other number means that this Item is external.
256+
`crate_id` | int | A number corresponding to the crate this Item is from. Used as an key to the `extern_crates` map in [Crate](#Crate). A value of zero represents an Item from the local crate, any other number means that this Item is external.
257257
`name` | String | The name of the Item, if present. Some Items, like impl blocks, do not have names.
258258
`span` | [Span](#Span) | (*Optional*) The source location of this Item.
259-
`visibility` | String | `"default"`, `"public"`, `"crate"`, or `"restricted"` (`pub(path)`).
260-
`restricted_path` | String | (*Optional*) If `visibility == "restricted"`, this field contains the path that it's restricted to.
259+
`visibility` | String | `"default"`, `"public"`, or `"crate"`[\*](#restricted-visibility).
261260
`docs` | String | The extracted documentation text from the Item.
262261
`links` | Map<String, [ID](#ID)> | A map of intra-doc link names to the IDs of the items they resolve to. For example if the `docs` string contained `"see [HashMap][std::collections::HashMap] for more details"` then `links` would have `"std::collections::HashMap": "<some id>"`.
263262
`attrs` | [String] | The [unstable](#Unstable) stringified attributes (other than doc comments) on the Item (e.g. `["#[inline]", "#[test]"]`).
264263
`deprecation` | [Deprecation](#Deprecation) | (*Optional*) Information about the Item's deprecation, if present.
265264
`kind` | String | The kind of Item this is. Determines what fields are in `inner`.
266265
`inner` | Object | The type-specific fields describing this Item. Check the `kind` field to determine what's available.
267266

267+
### Restricted visibility
268+
When using `--document-private-items`, `pub(in path)` items can appear in the output in which case
269+
the visibility field will be an Object instead of a string. It will contain the single key
270+
`"restricted"` with the following values:
271+
272+
Name | Type | Description
273+
----------|---------|------------------------------------------------------------------------------
274+
`parent` | [ID](#ID) | The ID of the module that this items visibility is restricted to.
275+
`path` | String | How that module path was referenced in the code (like `"super::super"`, or `"crate::foo"`).
276+
268277
### `kind == "module"`
269278

270279
Name | Type | Description

0 commit comments

Comments
 (0)