Struct IndexWrap
pub struct IndexWrap { /* private fields */ }Expand description
Wraps an index with negative indexing support.
Implementations§
§impl IndexWrap
impl IndexWrap
pub fn with_wrap_scalar(self, wrap_scalar: bool) -> IndexWrap
pub fn with_wrap_scalar(self, wrap_scalar: bool) -> IndexWrap
Set the policy for wrapping 0-size ranges.
When size == 0:
- if
wrap_scalar; thensize == 1 - otherwise; an error.
pub fn try_wrap<I>(&self, idx: I, size: usize) -> Result<usize, BoundsError>where
I: AsIndex,
pub fn try_wrap<I>(&self, idx: I, size: usize) -> Result<usize, BoundsError>where
I: AsIndex,
Wrap an index with negative indexing support.
pub fn expect_wrap<I>(&self, idx: I, size: usize) -> usizewhere
I: AsIndex,
pub fn expect_wrap<I>(&self, idx: I, size: usize) -> usizewhere
I: AsIndex,
Wrap an index with negative indexing support.
pub fn expect_elem<I>(idx: I, size: usize) -> usizewhere
I: AsIndex,
pub fn expect_elem<I>(idx: I, size: usize) -> usizewhere
I: AsIndex,
Short-form [NegativeWrap::index().expect_wrap(idx, size)].
pub fn expect_dim<I>(idx: I, size: usize) -> usizewhere
I: AsIndex,
pub fn expect_dim<I>(idx: I, size: usize) -> usizewhere
I: AsIndex,
Short-form [NegativeWrap::dim().expect_wrap(idx, size)].
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IndexWrap
impl RefUnwindSafe for IndexWrap
impl Send for IndexWrap
impl Sync for IndexWrap
impl Unpin for IndexWrap
impl UnwindSafe for IndexWrap
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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