Struct rustc_metadata::rmeta::Lazy[][src]

struct Lazy<T, Meta = Meta> where
    T: ?Sized + LazyMeta<Meta = Meta>,
    Meta: 'static + Copy
{ position: NonZeroUsize, meta: Meta, _marker: PhantomData<T>, }
Expand description

A value of type T referred to by its absolute position in the metadata, and which can be decoded lazily.

Metadata is effective a tree, encoded in post-order, and with the root’s position written next to the header. That means every single Lazy points to some previous location in the metadata and is part of a larger node.

The first Lazy in a node is encoded as the backwards distance from the position where the containing node starts and where the Lazy points to, while the rest use the forward distance from the previous Lazy. Distances start at 1, as 0-byte nodes are invalid. Also invalid are nodes being referred in a different order than they were encoded in.

Sequences (Lazy<[T]>)

Unlike Lazy<Vec<T>>, the length is encoded next to the position, not at the position, which means that the length doesn’t need to be known before encoding all the elements.

If the length is 0, no position is encoded, but otherwise, the encoding is that of Lazy, with the distinction that the minimal distance the length of the sequence, i.e. it’s assumed there’s no 0-byte element in the sequence.


position: NonZeroUsizemeta: Meta_marker: PhantomData<T>


Given the metadata, extract out the value at a particular index (if any).

Size of the table in entries, including possible gaps.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.


Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.