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.
Fields
position: NonZeroUsize
meta: Meta
_marker: PhantomData<T>
Implementations
Trait Implementations
impl<'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>
impl<'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]>
impl<'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,
impl<'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>
impl<'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]>
impl<'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,
Auto Trait Implementations
impl<T: ?Sized, Meta> RefUnwindSafe for Lazy<T, Meta> where
Meta: RefUnwindSafe,
T: RefUnwindSafe,
impl<T: ?Sized, Meta> UnwindSafe for Lazy<T, Meta> where
Meta: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
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.