Feature gate: #![feature(iter_array_chunks)]
This is a tracking issue for Iterator::array_chunks, an iterator adapter that allows to group elements of an iterator.
Public API
// trait Iterator
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where
Self: Sized,self);
// core::iter
pub struct ArrayChunks<I: Iterator, const N: usize> { ... }
impl<I, const N: usize> ArrayChunks<I, N> {
pub fn into_remainder(self) -> Option<array::IntoIter<I::Item, N>>;
}
impl<I: Iterator, const N: usize> Iterator for ArrayChunks<I, N> {
type Item = [I::Item; N];
}
impl<I: DoubleEndedIterator + ExactSizeIterator, const N: usize> DoubleEndedIterator for ArrayChunks<I, N> {}
impl<I: FusedIterator, const N: usize> FusedIterator for ArrayChunks<I, N> {}
impl<I: ExactSizeIterator, const N: usize> ExactSizeIterator for ArrayChunks<I, N> {}
Steps / History
Unresolved Questions
Feature gate:
#![feature(iter_array_chunks)]This is a tracking issue for
Iterator::array_chunks, an iterator adapter that allows to group elements of an iterator.Public API
Steps / History
Iterator::array_chunks(take N+1) #100026iter::ArrayChunks::into_remainder#149127Unresolved Questions
DoubleEndedIteratorbe implemented?ExactSizeIterator.rev().array_chunks()and.array_chunks().rev()are differentDoubleEndedIteratorimplementation should be improvedIterator::next_chunk_backlike there is for forwardunwrap_err_uncheckedinnext_back_remaindersound, despite not usingTrustedLen? (I didn't block the original PR on this because it goes throughtake, which I think we can trust, but I'd like someone smarter than me to think about it and confirm.)N != 0? (See also this same question in[T]::as_chunks.)array::IntoIter<T, N>and the current one where the items are[T; N]and there's a remainder? ([T]::array_chunkshas this question too and is unstable.)Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩