Struct extendr_api::prelude::utils::constrained::Size
#[repr(transparent)]pub struct Size<'n>(Branded<'n, usize>);
Expand description
usize
value tied to the lifetime 'n
.
Tuple Fields§
§0: Branded<'n, usize>
Implementations§
§impl<'size> Size<'size>
impl<'size> Size<'size>
pub fn with<R>(n: usize, f: impl for<'n> FnOnce(Size<'n>) -> R) -> R
pub fn with<R>(n: usize, f: impl for<'n> FnOnce(Size<'n>) -> R) -> R
Create a new Size
with a lifetime tied to n
.
pub fn with2<R>(
m: usize,
n: usize,
f: impl for<'m, 'n> FnOnce(Size<'m>, Size<'n>) -> R,
) -> R
pub fn with2<R>( m: usize, n: usize, f: impl for<'m, 'n> FnOnce(Size<'m>, Size<'n>) -> R, ) -> R
Create two new Size
with lifetimes tied to m
and n
.
pub unsafe fn new_raw_unchecked(n: usize) -> Size<'size>
pub unsafe fn new_raw_unchecked(n: usize) -> Size<'size>
Create a new Size
tied to the lifetime 'n
.
pub fn into_inner(self) -> usize
pub fn into_inner(self) -> usize
Returns the unconstrained value.
pub fn indices(self) -> impl DoubleEndedIterator
pub fn indices(self) -> impl DoubleEndedIterator
Returns an iterator of the indices smaller than self
.
Trait Implementations§
§impl<'n> Ord for Size<'n>
impl<'n> Ord for Size<'n>
§impl<'n> PartialOrd for Size<'n>
impl<'n> PartialOrd for Size<'n>
impl<'n> Copy for Size<'n>
impl<'n> Eq for Size<'n>
impl<'n> StructuralPartialEq for Size<'n>
Auto Trait Implementations§
impl<'n> Freeze for Size<'n>
impl<'n> RefUnwindSafe for Size<'n>
impl<'n> Send for Size<'n>
impl<'n> Sync for Size<'n>
impl<'n> Unpin for Size<'n>
impl<'n> UnwindSafe for Size<'n>
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