pub struct Id<T> { /* private fields */ }Available on crate feature
pui only.Expand description
A branded index that can be used to elide bounds checks
Implementations§
Source§impl<T> Id<T>
impl<T> Id<T>
Sourcepub const unsafe fn new_unchecked(index: usize, token: T) -> Self
pub const unsafe fn new_unchecked(index: usize, token: T) -> Self
Create a new branded index
§Safety
The given index must be in bounds for the PuiVec whose identifier owns
the given token
Sourcepub fn into_raw_parts(self) -> (usize, T)
pub fn into_raw_parts(self) -> (usize, T)
Get the index and token from the branded index
Trait Implementations§
Source§impl<I: OneShotIdentifier> BuildPuiVecIndex<I> for Id<I::Token>
impl<I: OneShotIdentifier> BuildPuiVecIndex<I> for Id<I::Token>
Source§unsafe fn new_unchecked(slice_index: Self::SliceIndex, ident: &I) -> Self
unsafe fn new_unchecked(slice_index: Self::SliceIndex, ident: &I) -> Self
Create a new
Self Read moreSource§impl<T: Ord> Ord for Id<T>
impl<T: Ord> Ord for Id<T>
Source§impl<T: PartialOrd> PartialOrd for Id<T>
impl<T: PartialOrd> PartialOrd for Id<T>
Source§impl<T, I: OneShotIdentifier> PuiVecAccess<T, I> for Id<I::Token>
impl<T, I: OneShotIdentifier> PuiVecAccess<T, I> for Id<I::Token>
Source§unsafe fn get_unchecked<'a>(&self, vec: &'a PuiVec<T, I>) -> &'a Self::Output
unsafe fn get_unchecked<'a>(&self, vec: &'a PuiVec<T, I>) -> &'a Self::Output
Returns a shared reference to the output at this location,
without performing any bounds checking. Calling this method with an
out-of-boundsindex or a dangling slice pointer is undefined behavior
even if the resulting reference is not used. Read more
Source§unsafe fn get_unchecked_mut<'a>(
&self,
vec: &'a mut PuiVec<T, I>,
) -> &'a mut Self::Output
unsafe fn get_unchecked_mut<'a>( &self, vec: &'a mut PuiVec<T, I>, ) -> &'a mut Self::Output
Returns a uniquue reference to the output at this location,
without performing any bounds checking. Calling this method with an
out-of-boundsindex or a dangling slice pointer is undefined behavior
even if the resulting reference is not used. Read more
Source§fn get<'a>(&self, vec: &'a PuiVec<T, I>) -> Option<&'a Self::Output>
fn get<'a>(&self, vec: &'a PuiVec<T, I>) -> Option<&'a Self::Output>
Returns a shared reference to the output at this location, if in bounds.
Source§fn get_mut<'a>(&self, vec: &'a mut PuiVec<T, I>) -> Option<&'a mut Self::Output>
fn get_mut<'a>(&self, vec: &'a mut PuiVec<T, I>) -> Option<&'a mut Self::Output>
Returns a unique reference to the output at this location, if in bounds.
Source§impl<I: OneShotIdentifier> PuiVecIndex<I> for Id<I::Token>
impl<I: OneShotIdentifier> PuiVecIndex<I> for Id<I::Token>
Source§type SliceIndex = usize
type SliceIndex = usize
The underlying index/range type
Source§fn contained_in<T>(&self, vec: &PuiVec<T, I>) -> bool
fn contained_in<T>(&self, vec: &PuiVec<T, I>) -> bool
Is self contained in
PuiVecimpl<T: Copy> Copy for Id<T>
impl<T: Eq> Eq for Id<T>
impl<T> StructuralPartialEq for Id<T>
Auto Trait Implementations§
impl<T> Freeze for Id<T>where
T: Freeze,
impl<T> RefUnwindSafe for Id<T>where
T: RefUnwindSafe,
impl<T> Send for Id<T>where
T: Send,
impl<T> Sync for Id<T>where
T: Sync,
impl<T> Unpin for Id<T>where
T: Unpin,
impl<T> UnwindSafe for Id<T>where
T: UnwindSafe,
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