Expand description
Rustdoc’s JSON output interface
These types are the public API exposed through the --output-format json
flag. The Crate
struct is the root of the JSON blob and all other items are contained within.
We expose a rustc-hash
feature that is disabled by default. This feature switches the
std::collections::HashMap
for [rustc_hash::FxHashMap
] to improve the performance of said
HashMap
in specific situations.
cargo-semver-checks
for example, saw a -3% improvement when benchmarking using the
aws_sdk_ec2
JSON output (~500MB of JSON). As always, we recommend measuring the impact before
turning this feature on, as FxHashMap
only concerns itself with hash speed, and may
increase the number of collisions.
Structs§
- Assoc
Item Constraint - Describes a bound applied to an associated type/constant.
- Constant
- A constant.
- Crate
- The root of the emitted JSON blob.
- Deprecation
- Information about the deprecation of an
Item
. - Discriminant
- The value that distinguishes a variant in an
Enum
from other variants. - DynTrait
- Dynamic trait object type (
dyn Trait
). - Enum
- An
enum
. - External
Crate - Metadata of a crate, either the same crate on which
rustdoc
was invoked, or its dependency. - Function
- A function declaration (including methods and other associated functions).
- Function
Header - A set of fundamental properties of a function.
- Function
Pointer - A type that is a function pointer.
- Function
Signature - The signature of a function.
- Generic
Param Def - One generic parameter accepted by an item.
- Generics
- Generic parameters accepted by an item and
where
clauses imposed on it and the parameters. - Id
- An opaque identifier for an item.
- Impl
- An
impl
block. - Item
- Anything that can hold documentation - modules, structs, enums, functions, traits, etc.
- Item
Summary - Information about an external (not defined in the local crate)
Item
. - Module
- A module declaration, e.g.
mod foo;
ormod foo {}
. - Path
- A type that has a simple path to it. This is the kind of type of structs, unions, enums, etc.
- Poly
Trait - A trait and potential HRTBs
- Primitive
- A primitive type declaration. Declarations of this kind can only come from the core library.
- Proc
Macro - A procedural macro.
- Span
- A range of source code.
- Static
- A
static
declaration. - Struct
- A
struct
. - Trait
- A
trait
declaration. - Trait
Alias - A trait alias declaration, e.g.
trait Int = Add + Sub + Mul + Div;
- Type
Alias - A type alias declaration, e.g.
type Pig = std::borrow::Cow<'static, str>;
- Union
- A
union
. - Use
- A
use
statement. - Variant
- A variant of an enum.
Enums§
- Abi
- The ABI (Application Binary Interface) used by a function.
- Assoc
Item Constraint Kind - The way in which an associate type/constant is bound.
- Generic
Arg - One argument in a list of generic arguments to a path segment.
- Generic
Args - A set of generic arguments provided to a path segment, e.g.
- Generic
Bound - Either a trait bound or a lifetime bound.
- Generic
Param DefKind - The kind of a
GenericParamDef
. - Item
Enum - Specific fields of an item.
- Item
Kind - The fundamental kind of an item. Unlike
ItemEnum
, this does not carry any additional info. - Macro
Kind - The way a
ProcMacro
is declared to be used. - Struct
Kind - The kind of a
Struct
and the data specific to it, i.e. fields. - Term
- Either a type or a constant, usually stored as the right-hand side of an equation in places like
AssocItemConstraint
- Trait
Bound Modifier - A set of modifiers applied to a trait.
- Type
- A type.
- Variant
Kind - The kind of an
Enum
Variant
and the data specific to it, i.e. fields. - Visibility
- Visibility of an
Item
. - Where
Predicate - One
where
clause.
Constants§
- FORMAT_
VERSION - The version of JSON output that this crate represents.