[−][src]Struct rustc_metadata::rmeta::Lazy
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
impl<'a, 'tcx, T: Decodable<DecodeContext<'a, 'tcx>>> Lazy<T>[src]
impl<'a: 'x, 'tcx: 'x, 'x, T: Decodable<DecodeContext<'a, 'tcx>>> Lazy<[T]>[src]
pub(in rmeta::decoder) fn decode<M: Metadata<'a, 'tcx>>(
self,
metadata: M
) -> impl ExactSizeIterator<Item = T> + Captures<'a> + Captures<'tcx> + 'x[src]
self,
metadata: M
) -> impl ExactSizeIterator<Item = T> + Captures<'a> + Captures<'tcx> + 'x
impl<I: Idx, T> Lazy<Table<I, T>> where
Option<T>: FixedSizeEncoding, [src]
Option<T>: FixedSizeEncoding,
pub(in rmeta) fn get<'a, 'tcx, M: Metadata<'a, 'tcx>>(
&self,
metadata: M,
i: I
) -> Option<T>[src]
&self,
metadata: M,
i: I
) -> Option<T>
Given the metadata, extract out the value at a particular index (if any).
pub(in rmeta) fn size(
&self
) -> usize[src]
&self
) -> usize
Size of the table in entries, including possible gaps.
impl<T: ?Sized + LazyMeta> Lazy<T>[src]
pub(in rmeta) fn from_position_and_meta(
position: NonZeroUsize,
meta: T::Meta
) -> Lazy<T>[src]
position: NonZeroUsize,
meta: T::Meta
) -> Lazy<T>
impl<T> Lazy<T>[src]
pub(in rmeta) fn from_position(
position: NonZeroUsize
) -> Lazy<T>[src]
position: NonZeroUsize
) -> Lazy<T>
impl<T> Lazy<[T]>[src]
Trait Implementations
impl<T: ?Sized + LazyMeta> Clone for Lazy<T>[src]
pub fn clone(&self) -> Self[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<T: ?Sized + LazyMeta> Copy for Lazy<T>[src]
impl<'a, 'tcx, T: Decodable<DecodeContext<'a, 'tcx>>> Decodable<DecodeContext<'a, 'tcx>> for Lazy<T>[src]
pub fn decode(decoder: &mut DecodeContext<'a, 'tcx>) -> Result<Self, String>[src]
impl<'a, 'tcx, T: Decodable<DecodeContext<'a, 'tcx>>> Decodable<DecodeContext<'a, 'tcx>> for Lazy<[T]>[src]
pub fn decode(decoder: &mut DecodeContext<'a, 'tcx>) -> Result<Self, String>[src]
impl<'a, 'tcx, I: Idx, T: Decodable<DecodeContext<'a, 'tcx>>> Decodable<DecodeContext<'a, 'tcx>> for Lazy<Table<I, T>> where
Option<T>: FixedSizeEncoding, [src]
Option<T>: FixedSizeEncoding,
pub fn decode(decoder: &mut DecodeContext<'a, 'tcx>) -> Result<Self, String>[src]
impl<'a, 'tcx, T: Encodable<EncodeContext<'a, 'tcx>>> Encodable<EncodeContext<'a, 'tcx>> for Lazy<T>[src]
pub fn encode(&self, e: &mut EncodeContext<'a, 'tcx>) -> EncodeResult[src]
impl<'a, 'tcx, T: Encodable<EncodeContext<'a, 'tcx>>> Encodable<EncodeContext<'a, 'tcx>> for Lazy<[T]>[src]
pub fn encode(&self, e: &mut EncodeContext<'a, 'tcx>) -> EncodeResult[src]
impl<'a, 'tcx, I: Idx, T: Encodable<EncodeContext<'a, 'tcx>>> Encodable<EncodeContext<'a, 'tcx>> for Lazy<Table<I, T>> where
Option<T>: FixedSizeEncoding, [src]
Option<T>: FixedSizeEncoding,
pub fn encode(&self, e: &mut EncodeContext<'a, 'tcx>) -> EncodeResult[src]
Auto Trait Implementations
impl<T: ?Sized, Meta> RefUnwindSafe for Lazy<T, Meta> where
Meta: RefUnwindSafe,
T: RefUnwindSafe,
Meta: RefUnwindSafe,
T: RefUnwindSafe,
impl<T: ?Sized, Meta> Send for Lazy<T, Meta> where
Meta: Send,
T: Send,
Meta: Send,
T: Send,
impl<T: ?Sized, Meta> Sync for Lazy<T, Meta> where
Meta: Sync,
T: Sync,
Meta: Sync,
T: Sync,
impl<T: ?Sized, Meta> Unpin for Lazy<T, Meta> where
Meta: Unpin,
T: Unpin,
Meta: Unpin,
T: Unpin,
impl<T: ?Sized, Meta> UnwindSafe for Lazy<T, Meta> where
Meta: UnwindSafe,
T: UnwindSafe,
Meta: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,