Struct extendr_api::prelude::utils::constrained::Idx
#[repr(transparent)]pub struct Idx<'n, I>(Branded<'n, I>);
Expand description
I
value smaller than the size corresponding to the lifetime 'n
.
Tuple Fields§
§0: Branded<'n, I>
Implementations§
§impl<'n, I> Idx<'n, I>where
I: Index,
impl<'n, I> Idx<'n, I>where
I: Index,
pub fn new_checked(idx: I, size: Size<'n>) -> Idx<'n, I>
pub fn new_checked(idx: I, size: Size<'n>) -> Idx<'n, I>
Returns a new index after asserting that it’s bounded by size
.
pub unsafe fn new_unchecked(idx: I, size: Size<'n>) -> Idx<'n, I>
pub unsafe fn new_unchecked(idx: I, size: Size<'n>) -> Idx<'n, I>
Returns a new index without asserting that it’s bounded by size
.
pub unsafe fn new_raw_unchecked(idx: I) -> Idx<'n, I>
pub unsafe fn new_raw_unchecked(idx: I) -> Idx<'n, I>
Returns a new index without asserting that it’s bounded by the value tied to the
lifetime 'n
.
pub fn into_inner(self) -> I
pub fn into_inner(self) -> I
Returns the unconstrained value.
pub 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
.
pub 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
.
pub 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
.
pub 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
.
pub 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
.
pub 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§
§impl<'n, I> Ord for Idx<'n, I>where
I: Ord,
impl<'n, I> Ord for Idx<'n, I>where
I: Ord,
§impl<'n, I> PartialOrd for Idx<'n, I>where
I: PartialOrd,
impl<'n, I> PartialOrd for Idx<'n, I>where
I: PartialOrd,
impl<'n, I> Copy for Idx<'n, I>where
I: Copy,
impl<'n, I> Eq for Idx<'n, I>where
I: Eq,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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