pub struct Idx<T> { /* private fields */ }Expand description
A 32-bit index into a flat table of T.
Idx<T> is Copy, is exactly four bytes, and has a niche, so Option<Idx<T>> is also
four bytes. Optional indices are everywhere in a compiler (no successor, no parent, no
spill slot) and paying eight bytes for each of them adds up, so the value is stored
biased by one over a NonZeroU32. That is where the limit of one below u32::MAX on the
largest representable index comes from.
Implementations§
Trait Implementations§
impl<T> Copy for Idx<T>
impl<T> Eq for Idx<T>
Source§impl<T> Ord for Idx<T>
impl<T> Ord for Idx<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Auto Trait Implementations§
impl<T> Freeze for Idx<T>
impl<T> RefUnwindSafe for Idx<T>
impl<T> Send for Idx<T>
impl<T> Sync for Idx<T>
impl<T> Unpin for Idx<T>
impl<T> UnsafeUnpin for Idx<T>
impl<T> UnwindSafe for Idx<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more