Skip to content

Commit

Permalink
Tweaks based on implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
P1n3appl3 committed Aug 14, 2020
1 parent a648bb5 commit 5571b39
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions text/0000-rustdoc-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ After running the above command, you should get a `lib.json` file like the follo
"includes_private": false,
"index": {
"0:3": {
"crate_num": 0,
"crate_id": 0,
"name": "some_fn",
"source": {
"filename": "lib.rs",
Expand All @@ -107,7 +107,7 @@ After running the above command, you should get a `lib.json` file like the follo
}
},
"0:4": {
"crate_num": 0,
"crate_id": 0,
"name": "SomeStruct",
"source": {
"filename": "lib.rs",
Expand All @@ -127,7 +127,7 @@ After running the above command, you should get a `lib.json` file like the follo
}
},
"0:0": {
"crate_num": 0,
"crate_id": 0,
"name": "lib",
"source": {
"filename": "lib.rs",
Expand All @@ -149,12 +149,12 @@ After running the above command, you should get a `lib.json` file like the follo
},
"paths": {
"0:3": {
"crate_num": 0,
"crate_id": 0,
"path": ["lib", "some_fn"],
"kind": "function"
},
"0:4": {
"crate_num": 0,
"crate_id": 0,
"path": ["lib", "SomeStruct"],
"kind": "struct"
},
Expand Down Expand Up @@ -241,7 +241,7 @@ Name | Type | Description

Name | Type | Description
----------|---------|------------------------------------------------------------------------------
`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.
`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.
`path` | [String] | The fully qualified path (e.g. `["std", "io", "lazy", "Lazy"]` for `std::io::lazy::Lazy`) of this Item.
`kind` | String | What type of Item this is (see [Item](#Item)).

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

Name | Type | Description
----------|---------|------------------------------------------------------------------------------
`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.
`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.
`name` | String | The name of the Item, if present. Some Items, like impl blocks, do not have names.
`span` | [Span](#Span) | (*Optional*) The source location of this Item.
`visibility` | String | `"default"`, `"public"`, `"crate"`, or `"restricted"` (`pub(path)`).
`restricted_path` | String | (*Optional*) If `visibility == "restricted"`, this field contains the path that it's restricted to.
`visibility` | String | `"default"`, `"public"`, or `"crate"`[\*](#restricted-visibility).
`docs` | String | The extracted documentation text from the Item.
`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>"`.
`attrs` | [String] | The [unstable](#Unstable) stringified attributes (other than doc comments) on the Item (e.g. `["#[inline]", "#[test]"]`).
`deprecation` | [Deprecation](#Deprecation) | (*Optional*) Information about the Item's deprecation, if present.
`kind` | String | The kind of Item this is. Determines what fields are in `inner`.
`inner` | Object | The type-specific fields describing this Item. Check the `kind` field to determine what's available.

### Restricted visibility
When using `--document-private-items`, `pub(in path)` items can appear in the output in which case
the visibility field will be an Object instead of a string. It will contain the single key
`"restricted"` with the following values:

Name | Type | Description
----------|---------|------------------------------------------------------------------------------
`parent` | [ID](#ID) | The ID of the module that this items visibility is restricted to.
`path` | String | How that module path was referenced in the code (like `"super::super"`, or `"crate::foo"`).

### `kind == "module"`

Name | Type | Description
Expand Down

0 comments on commit 5571b39

Please sign in to comment.