pub struct Idx<'n, I>(/* private fields */);
Expand description
I
value smaller than the size corresponding to the lifetime 'n
.
Implementations§
Source§impl<'n, I: Index> Idx<'n, I>
impl<'n, I: Index> Idx<'n, I>
Sourcepub fn new_checked(idx: I, size: Size<'n>) -> Self
pub fn new_checked(idx: I, size: Size<'n>) -> Self
Returns a new index after asserting that it’s bounded by size
.
Sourcepub unsafe fn new_unchecked(idx: I, size: Size<'n>) -> Self
pub unsafe fn new_unchecked(idx: I, size: Size<'n>) -> Self
Returns a new index without asserting that it’s bounded by size
.
Sourcepub unsafe fn new_raw_unchecked(idx: I) -> Self
pub unsafe fn new_raw_unchecked(idx: I) -> Self
Returns a new index without asserting that it’s bounded by the value tied to the
lifetime 'n
.
Sourcepub fn into_inner(self) -> I
pub fn into_inner(self) -> I
Returns the unconstrained value.
Sourcepub fn to_inclusive(self) -> IdxInclusive<'n, I>
pub fn to_inclusive(self) -> IdxInclusive<'n, I>
Returns the index, bounded inclusively by the value tied to 'n
.
Sourcepub fn next(self) -> IdxInclusive<'n, I>
pub fn next(self) -> IdxInclusive<'n, I>
Returns the next index, bounded inclusively by the value tied to 'n
.
Sourcepub fn from_slice_mut_checked<'a>(
slice: &'a mut [I],
size: Size<'n>,
) -> &'a mut [Idx<'n, I>]
pub fn from_slice_mut_checked<'a>( slice: &'a mut [I], size: Size<'n>, ) -> &'a mut [Idx<'n, I>]
Assert that the values of slice
are all bounded by size
.
Sourcepub unsafe fn from_slice_mut_unchecked<'a>(
slice: &'a mut [I],
) -> &'a mut [Idx<'n, I>]
pub unsafe fn from_slice_mut_unchecked<'a>( slice: &'a mut [I], ) -> &'a mut [Idx<'n, I>]
Assume that the values of slice
are all bounded by the value tied to 'n
.
Sourcepub fn from_slice_ref_checked<'a>(
slice: &'a [I],
size: Size<'n>,
) -> &'a [Idx<'n, I>]
pub fn from_slice_ref_checked<'a>( slice: &'a [I], size: Size<'n>, ) -> &'a [Idx<'n, I>]
Assert that the values of slice
are all bounded by size
.
Sourcepub unsafe fn from_slice_ref_unchecked<'a>(slice: &'a [I]) -> &'a [Idx<'n, I>]
pub unsafe fn from_slice_ref_unchecked<'a>(slice: &'a [I]) -> &'a [Idx<'n, I>]
Assume that the values of slice
are all bounded by the value tied to 'n
.
Trait Implementations§
Source§impl<'n, I: Ord> Ord for Idx<'n, I>
impl<'n, I: Ord> Ord for Idx<'n, I>
1.21.0 · 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
Source§impl<'n, I: PartialOrd> PartialOrd for Idx<'n, I>
impl<'n, I: PartialOrd> PartialOrd for Idx<'n, I>
impl<'n, I: Copy> Copy for Idx<'n, I>
impl<'n, I: Eq> Eq for Idx<'n, I>
impl<'n, I> StructuralPartialEq for Idx<'n, I>
Auto Trait Implementations§
impl<'n, I> Freeze for Idx<'n, I>where
I: Freeze,
impl<'n, I> RefUnwindSafe for Idx<'n, I>where
I: RefUnwindSafe,
impl<'n, I> Send for Idx<'n, I>where
I: Send,
impl<'n, I> Sync for Idx<'n, I>where
I: Sync,
impl<'n, I> Unpin for Idx<'n, I>where
I: Unpin,
impl<'n, I> UnwindSafe for Idx<'n, I>where
I: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more