pub struct Cache {
pub typarams: FxHashMap<DefId, String>,
pub impls: FxHashMap<DefId, Vec<Impl>>,
pub paths: FxHashMap<DefId, (Vec<String>, ItemType)>,
pub external_paths: FxHashMap<DefId, (Vec<String>, ItemType)>,
pub exact_paths: FxHashMap<DefId, Vec<String>>,
pub traits: FxHashMap<DefId, Trait>,
pub implementors: FxHashMap<DefId, Vec<Impl>>,
pub extern_locations: FxHashMap<CrateNum, (String, PathBuf, ExternalLocation)>,
pub primitive_locations: FxHashMap<PrimitiveType, DefId>,
pub access_levels: Arc<AccessLevels<DefId>>,
pub crate_version: Option<String>,
stack: Vec<String>,
parent_stack: Vec<DefId>,
parent_is_trait_impl: bool,
search_index: Vec<IndexItem>,
stripped_mod: bool,
deref_trait_did: Option<DefId>,
deref_mut_trait_did: Option<DefId>,
owned_box_did: Option<DefId>,
masked_crates: FxHashSet<CrateNum>,
orphan_impl_items: Vec<(DefId, Item)>,
aliases: FxHashMap<String, Vec<IndexItem>>,
}
This cache is used to store information about the clean::Crate
being
rendered in order to provide more useful documentation. This contains
information like all implementors of a trait, all traits a type implements,
documentation for all known traits, etc.
This structure purposefully does not implement Clone
because it's intended
to be a fairly large and expensive structure to clone. Instead this adheres
to Send
so it may be stored in a Arc
instance and shared among the various
rendering threads.
Mapping of typaram ids to the name of the type parameter. This is used
when pretty-printing a type (so pretty printing doesn't have to
painfully maintain a context like this)
Maps a type id to all known implementations for that type. This is only
recognized for intra-crate ResolvedPath
types, and is used to print
out extra documentation on the page of an enum/struct.
The values of the map are a list of implementations and documentation
found on that implementation.
Maintains a mapping of local crate node ids to the fully qualified name
and "short type description" of that node. This is used when generating
URLs when a type is being linked to. External paths are not located in
this map because the External
type itself has all the information
necessary.
Similar to paths
, but only holds external paths. This is only used for
generating explicit hyperlinks to other crates.
Maps local def ids of exported types to fully qualified paths.
Unlike 'paths', this mapping ignores any renames that occur
due to 'use' statements.
This map is used when writing out the special 'implementors'
javascript file. By using the exact path that the type
is declared with, we ensure that each path will be identical
to the path used if the corresponding type is inlined. By
doing this, we can detect duplicate impls on a trait page, and only display
the impl for the inlined type.
This map contains information about all known traits of this crate.
Implementations of a crate should inherit the documentation of the
parent trait if no extra documentation is specified, and default methods
should show up in documentation about trait implementations.
When rendering traits, it's often useful to be able to list all
implementors of the trait, and this mapping is exactly, that: a mapping
of trait ids to the list of known implementors of the trait
Cache of where external crate documentation can be found.
Cache of where documentation for primitives can be found.
The version of the crate being documented, if given from the --crate-version
flag.
Aliases added through #[doc(alias = "...")]
. Since a few items can have the same alias,
we need the alias element to have an array of items.
Returns the "default value" for a type. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S
is the encoder/decoder state type, T
is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?