pub(crate) struct CrateMetadataRef<'a> {
    pub cdata: &'a CrateMetadata,
    pub cstore: &'a CStore,
}
Expand description

A reference to CrateMetadata that can also give access to whole crate store when necessary.

Fields

cdata: &'a CrateMetadatacstore: &'a CStore

Implementations

Iterates over all the stability attributes in the given crate.

Iterates over the language items in the given crate.

Iterates over the diagnostic items in the given crate.

Iterates over all named children of the given module, including both proper items and reexports. Module here is understood in name resolution sense - it can be a mod item, or a crate root, or an enum, or a trait.

Decodes all inherent impls in the crate (for rustdoc).

Decodes all traits in the crate (for rustdoc and rustc diagnostics).

Decodes all trait impls in the crate (for rustdoc).

Imports the source_map from an external crate into the source_map of the crate currently being compiled (the “local crate”).

The import algorithm works analogous to how AST items are inlined from an external crate’s metadata: For every SourceFile in the external source_map an ‘inline’ copy is created in the local source_map. The correspondence relation between external and local SourceFiles is recorded in the ImportedSourceFile objects returned from this function. When an item from an external crate is later inlined into this crate, this correspondence information is used to translate the span information of the inlined item so that it refers the correct positions in the local source_map (see <decoder::DecodeContext as SpecializedDecoder<Span>>).

The import algorithm in the function below will reuse SourceFiles already existing in the local source_map. For example, even if the SourceFile of some source file of libstd gets imported many times, there will only ever be one SourceFile object for the corresponding file in the local source_map.

Note that imported SourceFiles do not actually contain the source code of the file they represent, just information about length, line breaks, and multibyte characters. This information is enough to generate valid debuginfo for items inlined from other crates.

Proc macro crates don’t currently export spans, so this function does not have to work for them.

Methods from Deref<Target = CrateMetadata>

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 16 bytes