Function iter_next_chunk

pub(crate) const fn iter_next_chunk<T, const N: usize>(iter: &mut impl ~const Iterator<Item = T>) -> Result<[T; N], IntoIter<T, N>>

Pulls N items from iter and returns them as an array. If the iterator yields fewer than N items, Err is returned containing an iterator over the already yielded items.

Since the iterator is passed as a mutable reference and this function calls next at most N times, the iterator can still be used afterwards to retrieve the remaining items.

If iter.next() panics, all items already yielded by the iterator are dropped.

Used for Iterator::next_chunk.