Struct ChunksMut
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct ChunksMut<'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 beginning 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 chunks_mut method on slices.
Example
let mut slice = ;
let iter = slice.chunks_mut;
Fields
v: *mut [T]Safety
This slice pointer must point at a valid region of
Twith at least lengthv.len(). Normally, those requirements would mean that we could instead use a&mut [T]here, but we cannot because__iterator_get_uncheckedneeds 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> ChunksMut<'a, T>
const fn new(slice: &'a mut [T], size: usize) -> Self
Trait Implementations
impl<'a, T> DoubleEndedIterator for ChunksMut<'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 ChunksMut<'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) -> usizefn 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 ChunksMut<'a, T>
impl<'a, T> TrustedRandomAccessNoCoerce for ChunksMut<'a, T>
const MAY_HAVE_SIDE_EFFECT: bool = false;
impl<'a, T: Debug + 'a> Debug for ChunksMut<'a, T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T> ExactSizeIterator for ChunksMut<'_, T>
impl<T> FusedIterator for ChunksMut<'_, T>
impl<T> Send for ChunksMut<'_, T>
where
T: Send,
impl<T> Sync for ChunksMut<'_, T>
where
T: Sync,
impl<T> TrustedLen for ChunksMut<'_, T>
Auto Trait Implementations
impl<'a, T> !UnwindSafe for ChunksMut<'a, T>
impl<'a, T> Freeze for ChunksMut<'a, T>
where
*mut [T]: Freeze,
PhantomData<&'a mut T>: Freeze,
impl<'a, T> RefUnwindSafe for ChunksMut<'a, T>
where
*mut [T]: RefUnwindSafe,
PhantomData<&'a mut T>: RefUnwindSafe,
impl<'a, T> Unpin for ChunksMut<'a, T>
where
*mut [T]: Unpin,
PhantomData<&'a mut T>: Unpin,
impl<'a, T> UnsafeUnpin for ChunksMut<'a, T>
where
*mut [T]: UnsafeUnpin,
PhantomData<&'a mut T>: UnsafeUnpin,
Blanket Implementations
impl<I> IntoIterator for ChunksMut<'a, T>
where
I: Iterator,
type Item = <I as Iterator>::Item;type IntoIter = I;fn into_iter(self) -> I
impl<T> Any for ChunksMut<'a, T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for ChunksMut<'a, T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for ChunksMut<'a, T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for ChunksMut<'a, T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for ChunksMut<'a, T>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for ChunksMut<'a, T>
impl<T, U> Into<U> for ChunksMut<'a, T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for ChunksMut<'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 ChunksMut<'a, T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>