Struct rustdoc::formats::cache::Cache[−][src]

pub(crate) struct Cache {
Show fields pub(crate) impls: FxHashMap<DefId, Vec<Impl>>, pub(crate) paths: FxHashMap<DefId, (Vec<String>, ItemType)>, pub(crate) external_paths: FxHashMap<DefId, (Vec<String>, ItemType)>, pub(crate) exact_paths: FxHashMap<DefId, Vec<String>>, pub(crate) traits: FxHashMap<DefId, TraitWithExtraInfo>, pub(crate) implementors: FxHashMap<FakeDefId, Vec<Impl>>, pub(crate) extern_locations: FxHashMap<CrateNum, ExternalLocation>, pub(crate) primitive_locations: FxHashMap<PrimitiveType, DefId>, pub(crate) access_levels: AccessLevels<DefId>, pub(crate) crate_version: Option<String>, pub(crate) document_private: bool, pub(crate) masked_crates: FxHashSet<CrateNum>, stack: Vec<String>, parent_stack: Vec<DefId>, parent_is_trait_impl: bool, stripped_mod: bool, pub(crate) search_index: Vec<IndexItem>, pub(crate) deref_trait_did: Option<DefId>, pub(crate) deref_mut_trait_did: Option<DefId>, pub(crate) owned_box_did: Option<DefId>, pub(crate) orphan_impl_items: Vec<(DefId, Item)>, orphan_trait_impls: Vec<(DefId, FxHashSet<DefId>, Impl)>, pub(crate) intra_doc_links: BTreeMap<FakeDefId, Vec<ItemLink>>,
}
Expand description

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.

Fields

impls: FxHashMap<DefId, Vec<Impl>>
Expand description

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.

paths: FxHashMap<DefId, (Vec<String>, ItemType)>
Expand description

Maintains a mapping of local crate DefIds 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.

external_paths: FxHashMap<DefId, (Vec<String>, ItemType)>
Expand description

Similar to paths, but only holds external paths. This is only used for generating explicit hyperlinks to other crates.

exact_paths: FxHashMap<DefId, Vec<String>>
Expand description

Maps local DefIds 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.

traits: FxHashMap<DefId, TraitWithExtraInfo>
Expand description

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.

implementors: FxHashMap<FakeDefId, Vec<Impl>>
Expand description

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

extern_locations: FxHashMap<CrateNum, ExternalLocation>
Expand description

Cache of where external crate documentation can be found.

primitive_locations: FxHashMap<PrimitiveType, DefId>
Expand description

Cache of where documentation for primitives can be found.

access_levels: AccessLevels<DefId>crate_version: Option<String>
Expand description

The version of the crate being documented, if given from the --crate-version flag.

document_private: bool
Expand description

Whether to document private items. This is stored in Cache so it doesn’t need to be passed through all rustdoc functions.

masked_crates: FxHashSet<CrateNum>
Expand description

Crates marked with #[doc(masked)].

stack: Vec<String>parent_stack: Vec<DefId>parent_is_trait_impl: boolstripped_mod: boolsearch_index: Vec<IndexItem>deref_trait_did: Option<DefId>deref_mut_trait_did: Option<DefId>owned_box_did: Option<DefId>orphan_impl_items: Vec<(DefId, Item)>orphan_trait_impls: Vec<(DefId, FxHashSet<DefId>, Impl)>intra_doc_links: BTreeMap<FakeDefId, Vec<ItemLink>>
Expand description

All intra-doc links resolved so far.

Links are indexed by the DefId of the item they document.

Implementations

impl Cache[src]

pub(crate) fn new(
    access_levels: AccessLevels<DefId>,
    document_private: bool
) -> Self
[src]

pub(crate) fn populate(
    &mut self,
    krate: Crate,
    tcx: TyCtxt<'_>,
    extern_html_root_urls: &BTreeMap<String, String>,
    dst: &Path
) -> Crate
[src]

Populates the Cache with more data. The returned Crate will be missing some data that was in krate due to the data being moved into the Cache.

Trait Implementations

impl Default for Cache[src]

fn default() -> Cache[src]

Returns the “default value” for a type. Read more

Auto Trait Implementations

impl !RefUnwindSafe for Cache

impl !Send for Cache

impl !Sync for Cache

impl Unpin for Cache

impl !UnwindSafe for Cache

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> WithConstness for T[src]

fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]

fn with_const(self) -> ConstnessAnd<Self>[src]

fn without_const(self) -> ConstnessAnd<Self>[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]