Struct itertools::StrideMut
[−]
[src]
pub struct StrideMut<'a, A: 'a> { // some fields omitted }
The mutable equivalent of Stride.
StrideMut
does not support zero-sized types for A
.
Iterator element type is &'a mut A
.
Methods
impl<'a, A> StrideMut<'a, A>
unsafe fn from_ptr_len(begin: *mut A, nelem: usize, stride: isize) -> StrideMut<'a, A>
Create a StrideMut iterator from a raw pointer.
impl<'a, A> StrideMut<'a, A>
fn from_slice(xs: &'a mut [A], step: isize) -> StrideMut<'a, A>
Create Stride iterator from a slice and the element step count.
If step
is negative, start from the back.
use itertools::Stride; let xs = [0, 1, 2, 3, 4, 5]; let front = Stride::from_slice(&xs, 2); assert_eq!(front[0], 0); assert_eq!(front[1], 2); let back = Stride::from_slice(&xs, -2); assert_eq!(back[0], 5); assert_eq!(back[1], 3);
Panics if values of type A
are zero-sized.
Panics if step
is 0.
fn from_stride(it: StrideMut<'a, A>, step: isize) -> StrideMut<'a, A>
Create Stride iterator from an existing Stride iterator
Panics if step
is 0.
fn swap_ends(&mut self)
Swap the begin and end and reverse the stride, in effect reversing the iterator.
fn len(&self) -> usize
Return the number of elements in the iterator.
fn get<'b>(&'b self, i: usize) -> Option<&'b A>
Return a reference to the element of a stride at the given index, or None if the index is out of bounds.
impl<'a, A> StrideMut<'a, A>
fn get_mut<'b>(&'b mut self, i: usize) -> Option<&'b mut A>
Return a mutable reference to the element of a stride at the given index, or None if the index is out of bounds.