Struct rustc_metadata::rmeta::Lazy
source · [−]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.
Fields
position: NonZeroUsizemeta: Meta_marker: PhantomData<T>Implementations
sourceimpl<'a, 'tcx, T: Decodable<DecodeContext<'a, 'tcx>>> Lazy<T>
impl<'a, 'tcx, T: Decodable<DecodeContext<'a, 'tcx>>> Lazy<T>
sourceimpl<T: ?Sized + LazyMeta> Lazy<T>
impl<T: ?Sized + LazyMeta> Lazy<T>
fn from_position_and_meta(position: NonZeroUsize, meta: T::Meta) -> Lazy<T>
sourceimpl<T> Lazy<T>
impl<T> Lazy<T>
fn from_position(position: NonZeroUsize) -> Lazy<T>
Trait Implementations
sourceimpl<'a, 'tcx, T: Decodable<DecodeContext<'a, 'tcx>>> Decodable<DecodeContext<'a, 'tcx>> for Lazy<T>
impl<'a, 'tcx, T: Decodable<DecodeContext<'a, 'tcx>>> Decodable<DecodeContext<'a, 'tcx>> for Lazy<T>
fn decode(decoder: &mut DecodeContext<'a, 'tcx>) -> Self
sourceimpl<'a, 'tcx, T: Decodable<DecodeContext<'a, 'tcx>>> Decodable<DecodeContext<'a, 'tcx>> for Lazy<[T]>
impl<'a, 'tcx, T: Decodable<DecodeContext<'a, 'tcx>>> Decodable<DecodeContext<'a, 'tcx>> for Lazy<[T]>
fn decode(decoder: &mut DecodeContext<'a, 'tcx>) -> Self
sourceimpl<'a, 'tcx, I: Idx, T: Decodable<DecodeContext<'a, 'tcx>>> Decodable<DecodeContext<'a, 'tcx>> for Lazy<Table<I, T>> where
Option<T>: FixedSizeEncoding,
impl<'a, 'tcx, I: Idx, T: Decodable<DecodeContext<'a, 'tcx>>> Decodable<DecodeContext<'a, 'tcx>> for Lazy<Table<I, T>> where
Option<T>: FixedSizeEncoding,
fn decode(decoder: &mut DecodeContext<'a, 'tcx>) -> Self
sourceimpl<'a, 'tcx, T: Encodable<EncodeContext<'a, 'tcx>>> Encodable<EncodeContext<'a, 'tcx>> for Lazy<T>
impl<'a, 'tcx, T: Encodable<EncodeContext<'a, 'tcx>>> Encodable<EncodeContext<'a, 'tcx>> for Lazy<T>
fn encode(&self, e: &mut EncodeContext<'a, 'tcx>) -> EncodeResult
sourceimpl<'a, 'tcx, T: Encodable<EncodeContext<'a, 'tcx>>> Encodable<EncodeContext<'a, 'tcx>> for Lazy<[T]>
impl<'a, 'tcx, T: Encodable<EncodeContext<'a, 'tcx>>> Encodable<EncodeContext<'a, 'tcx>> for Lazy<[T]>
fn encode(&self, e: &mut EncodeContext<'a, 'tcx>) -> EncodeResult
sourceimpl<'a, 'tcx, I: Idx, T: Encodable<EncodeContext<'a, 'tcx>>> Encodable<EncodeContext<'a, 'tcx>> for Lazy<Table<I, T>> where
Option<T>: FixedSizeEncoding,
impl<'a, 'tcx, I: Idx, T: Encodable<EncodeContext<'a, 'tcx>>> Encodable<EncodeContext<'a, 'tcx>> for Lazy<Table<I, T>> where
Option<T>: FixedSizeEncoding,
fn encode(&self, e: &mut EncodeContext<'a, 'tcx>) -> EncodeResult
impl<T: ?Sized + LazyMeta> Copy for Lazy<T>
Auto Trait Implementations
impl<T: ?Sized, Meta> RefUnwindSafe for Lazy<T, Meta> where
Meta: RefUnwindSafe,
T: RefUnwindSafe,
impl<T: ?Sized, Meta> Send for Lazy<T, Meta> where
Meta: Send,
T: Send,
impl<T: ?Sized, Meta> Sync for Lazy<T, Meta> where
Meta: Sync,
T: Sync,
impl<T: ?Sized, Meta> Unpin for Lazy<T, Meta> where
Meta: Unpin,
T: Unpin,
impl<T: ?Sized, Meta> UnwindSafe for Lazy<T, Meta> where
Meta: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<'a, T> Captures<'a> for T where
T: ?Sized,
Layout
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.