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) -> Self
pub fn with_wrap_scalar(self, wrap_scalar: bool) -> Self
Set the policy for wrapping 0-size ranges.
When size == 0:
- if
wrap_scalar; thensize == 1 - otherwise; an error.
Sourcepub fn try_wrap<I: AsIndex>(
&self,
idx: I,
size: usize,
) -> Result<usize, BoundsError>
pub fn try_wrap<I: AsIndex>( &self, idx: I, size: usize, ) -> Result<usize, BoundsError>
Wrap an index with negative indexing support.
Sourcepub fn expect_wrap<I: AsIndex>(&self, idx: I, size: usize) -> usize
pub fn expect_wrap<I: AsIndex>(&self, idx: I, size: usize) -> usize
Wrap an index with negative indexing support.
Sourcepub fn expect_elem<I: AsIndex>(idx: I, size: usize) -> usize
pub fn expect_elem<I: AsIndex>(idx: I, size: usize) -> usize
Short-form [NegativeWrap::index().expect_wrap(idx, size)].
Sourcepub fn expect_dim<I: AsIndex>(idx: I, size: usize) -> usize
pub fn expect_dim<I: AsIndex>(idx: I, size: usize) -> usize
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