array_chunks 1.0.0

adds array_chunks back in
Documentation
  • Coverage
  • 80%
    8 out of 10 items documented4 out of 9 items with examples
  • Size
  • Source code size: 12.8 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.96 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • bend-n/atools
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • bend-n

After array_chunks was brutally taken from us in #143289, I have taken it upon myself to diligently add it back to rust.

rust 1.88.0 rust stable

An iterator over a slice in (non-overlapping) chunks (N elements at a time), starting at the beginning of the slice.

use array_chunks::*;
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.array_chunks::<2>();
assert_eq!(iter.next(), Some(&['l', 'o']));
assert_eq!(iter.next(), Some(&['r', 'e']));
assert_eq!(iter.next(), None);