Struct Chunks
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct Chunks<'a, T: 'a> { pub(in ::slice::iter) v: &'a [T], pub(in ::slice::iter) chunk_size: usize }
An iterator over a slice in (non-overlapping) 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 method on slices.
Example
let slice = ;
let mut iter = slice.chunks;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Fields
v: &'a [T]chunk_size: usize
Implementations
impl<'a, T: 'a> Chunks<'a, T>
const fn new(slice: &'a [T], size: usize) -> Self
Trait Implementations
impl<'a, T> DoubleEndedIterator for Chunks<'a, T>
fn next_back(&mut self) -> Option<&'a [T]>fn nth_back(&mut self, n: usize) -> Option<Self::Item>
impl<'a, T> Iterator for Chunks<'a, T>
type Item = &'a [T];fn next(&mut self) -> Option<&'a [T]>fn size_hint(&self) -> (usize, Option<usize>)fn count(self) -> usizefn nth(&mut self, n: usize) -> Option<Self::Item>fn last(self) -> Option<Self::Item>unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item
impl<'a, T> TrustedRandomAccess for Chunks<'a, T>
impl<'a, T> TrustedRandomAccessNoCoerce for Chunks<'a, T>
const MAY_HAVE_SIDE_EFFECT: bool = false;
impl<'a, T: Debug + 'a> Debug for Chunks<'a, T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T> Clone for Chunks<'_, T>
fn clone(&self) -> Self
impl<T> ExactSizeIterator for Chunks<'_, T>
impl<T> FusedIterator for Chunks<'_, T>
impl<T> TrustedLen for Chunks<'_, T>
Auto Trait Implementations
impl<'a, T> Freeze for Chunks<'a, T>
where
&'a [T]: Freeze,
impl<'a, T> RefUnwindSafe for Chunks<'a, T>
where
&'a [T]: RefUnwindSafe,
impl<'a, T> Send for Chunks<'a, T>
where
&'a [T]: Send,
impl<'a, T> Sync for Chunks<'a, T>
where
&'a [T]: Sync,
impl<'a, T> Unpin for Chunks<'a, T>
where
&'a [T]: Unpin,
impl<'a, T> UnsafeUnpin for Chunks<'a, T>
where
&'a [T]: UnsafeUnpin,
impl<'a, T> UnwindSafe for Chunks<'a, T>
where
&'a [T]: UnwindSafe,
Blanket Implementations
impl<I> IntoIterator for Chunks<'a, T>
where
I: Iterator,
type Item = <I as Iterator>::Item;type IntoIter = I;fn into_iter(self) -> I
impl<T> Any for Chunks<'a, T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Chunks<'a, T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Chunks<'a, T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Chunks<'a, T>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Chunks<'a, T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Chunks<'a, T>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Chunks<'a, T>
impl<T, U> Into<U> for Chunks<'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 Chunks<'a, T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Chunks<'a, T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>