pub struct MaybeIdx<'n, I: Index>(/* private fields */);
Expand description
I
value smaller than the size corresponding to the lifetime 'n
, or None
.
Implementations§
Source§impl<'n, I: Index> MaybeIdx<'n, I>
impl<'n, I: Index> MaybeIdx<'n, I>
Sourcepub fn from_index(idx: Idx<'n, I>) -> Self
pub fn from_index(idx: Idx<'n, I>) -> Self
Returns an index value.
Sourcepub fn new_checked(idx: I::Signed, size: Size<'n>) -> Self
pub fn new_checked(idx: I::Signed, size: Size<'n>) -> Self
Returns a constrained index value if idx
is nonnegative, None
otherwise.
Sourcepub unsafe fn new_unchecked(idx: I::Signed, size: Size<'n>) -> Self
pub unsafe fn new_unchecked(idx: I::Signed, size: Size<'n>) -> Self
Returns a constrained index value if idx
is nonnegative, None
otherwise.
Sourcepub unsafe fn new_raw_unchecked(idx: I) -> Self
pub unsafe fn new_raw_unchecked(idx: I) -> Self
Returns a constrained index value if idx
is nonnegative, None
otherwise.
Sourcepub fn into_inner(self) -> I
pub fn into_inner(self) -> I
Returns the inner value.
Sourcepub fn from_slice_mut_checked<'a>(
slice: &'a mut [I::Signed],
size: Size<'n>,
) -> &'a mut [MaybeIdx<'n, I>]
pub fn from_slice_mut_checked<'a>( slice: &'a mut [I::Signed], size: Size<'n>, ) -> &'a mut [MaybeIdx<'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::Signed],
) -> &'a mut [MaybeIdx<'n, I>]
pub unsafe fn from_slice_mut_unchecked<'a>( slice: &'a mut [I::Signed], ) -> &'a mut [MaybeIdx<'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::Signed],
size: Size<'n>,
) -> &'a [MaybeIdx<'n, I>]
pub fn from_slice_ref_checked<'a>( slice: &'a [I::Signed], size: Size<'n>, ) -> &'a [MaybeIdx<'n, I>]
Assert that the values of slice
are all bounded by size
.
Sourcepub fn as_slice_ref<'a>(slice: &'a [MaybeIdx<'n, I>]) -> &'a [I::Signed]
pub fn as_slice_ref<'a>(slice: &'a [MaybeIdx<'n, I>]) -> &'a [I::Signed]
Convert a constrained slice to an unconstrained one.
Sourcepub unsafe fn from_slice_ref_unchecked<'a>(
slice: &'a [I::Signed],
) -> &'a [MaybeIdx<'n, I>]
pub unsafe fn from_slice_ref_unchecked<'a>( slice: &'a [I::Signed], ) -> &'a [MaybeIdx<'n, I>]
Assume that the values of slice
are all bounded by the value tied to 'n
.
Trait Implementations§
impl<'n, I: Copy + Index> Copy for MaybeIdx<'n, I>
impl<'n, I: Eq + Index> Eq for MaybeIdx<'n, I>
impl<'n, I: Index> StructuralPartialEq for MaybeIdx<'n, I>
Auto Trait Implementations§
impl<'n, I> Freeze for MaybeIdx<'n, I>where
I: Freeze,
impl<'n, I> RefUnwindSafe for MaybeIdx<'n, I>where
I: RefUnwindSafe,
impl<'n, I> Send for MaybeIdx<'n, I>
impl<'n, I> Sync for MaybeIdx<'n, I>
impl<'n, I> Unpin for MaybeIdx<'n, I>where
I: Unpin,
impl<'n, I> UnwindSafe for MaybeIdx<'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