pub struct IndexWrap { /* private fields */ }Expand description
Wraps an index with negative indexing support.
Implementations§
Source§impl IndexWrap
impl IndexWrap
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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)].
Sourcepub 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§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more