Struct RChunksMut

#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct RChunksMut<'a, T: 'a> { pub(in ::slice::iter) v: *mut [T], pub(in ::slice::iter) chunk_size: usize, pub(in ::slice::iter) _marker: PhantomData<&'a mut T> }

An iterator over a slice in (non-overlapping) mutable chunks (chunk_size elements at a time), starting at the end of the slice.

When the slice len is not evenly divided by the chunk size, the last slice of the iteration will be the remainder.

This struct is created by the rchunks_mut method on slices.

Example

let mut slice = ['l', 'o', 'r', 'e', 'm'];
let iter = slice.rchunks_mut(2);

Fields

v: *mut [T]

Safety

This slice pointer must point at a valid region of T with at least length v.len(). Normally, those requirements would mean that we could instead use a &mut [T] here, but we cannot because __iterator_get_unchecked needs to return &mut [T], which guarantees certain aliasing properties that we cannot uphold if we hold on to the full original &mut [T]. Wrapping a raw slice instead lets us hand out non-overlapping &mut [T] subslices of the slice we wrap.

chunk_size: usize
_marker: PhantomData<&'a mut T>

Implementations

impl<'a, T: 'a> RChunksMut<'a, T>

const fn new(slice: &'a mut [T], size: usize) -> Self

Trait Implementations

impl<'a, T> DoubleEndedIterator for RChunksMut<'a, T>

fn next_back(&mut self) -> Option<&'a mut [T]>
fn nth_back(&mut self, n: usize) -> Option<Self::Item>

impl<'a, T> Iterator for RChunksMut<'a, T>

type Item = &'a mut [T];
fn next(&mut self) -> Option<&'a mut [T]>
fn size_hint(&self) -> (usize, Option<usize>)
fn count(self) -> usize
fn nth(&mut self, n: usize) -> Option<&'a mut [T]>
fn last(self) -> Option<Self::Item>
unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item

impl<'a, T> TrustedRandomAccess for RChunksMut<'a, T>

impl<'a, T> TrustedRandomAccessNoCoerce for RChunksMut<'a, T>

const MAY_HAVE_SIDE_EFFECT: bool = false;

impl<'a, T: Debug + 'a> Debug for RChunksMut<'a, T>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<T> ExactSizeIterator for RChunksMut<'_, T>

impl<T> FusedIterator for RChunksMut<'_, T>

impl<T> Send for RChunksMut<'_, T> where T: Send,

impl<T> Sync for RChunksMut<'_, T> where T: Sync,

impl<T> TrustedLen for RChunksMut<'_, T>

Auto Trait Implementations

impl<'a, T> !UnwindSafe for RChunksMut<'a, T>

impl<'a, T> Freeze for RChunksMut<'a, T> where *mut [T]: Freeze, PhantomData<&'a mut T>: Freeze,

impl<'a, T> RefUnwindSafe for RChunksMut<'a, T> where *mut [T]: RefUnwindSafe, PhantomData<&'a mut T>: RefUnwindSafe,

impl<'a, T> Unpin for RChunksMut<'a, T> where *mut [T]: Unpin, PhantomData<&'a mut T>: Unpin,

impl<'a, T> UnsafeUnpin for RChunksMut<'a, T> where *mut [T]: UnsafeUnpin, PhantomData<&'a mut T>: UnsafeUnpin,

Blanket Implementations

impl<I> IntoIterator for RChunksMut<'a, T> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

impl<T> Any for RChunksMut<'a, T> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for RChunksMut<'a, T> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for RChunksMut<'a, T> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for RChunksMut<'a, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for RChunksMut<'a, T> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for RChunksMut<'a, T>

impl<T, U> Into<U> for RChunksMut<'a, T> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for RChunksMut<'a, T> where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for RChunksMut<'a, T> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>