Crate const_chunks
source ·Expand description
This crate provides an extension trait that lets you chunk iterators into constant-length arrays using const
generics.
See the IteratorConstChunks::const_chunks
docs for more info.
use const_chunks::IteratorConstChunks;
let v = vec![1, 2, 3, 4, 5, 6];
let mut v_iter = v.into_iter().const_chunks::<2>();
assert_eq!(v_iter.next(), Some([1,2]));
assert_eq!(v_iter.next(), Some([3,4]));
assert_eq!(v_iter.next(), Some([5,6]));
Structs
- An iterator that iterates over constant-length chunks, where the length is known at compile time.
Traits
- An extension trait providing
Iterator
s with the capability to iterate over chunks of items.