#array #back

no-std array_chunks

adds array_chunks back in

1 stable release

1.0.0 Jul 31, 2025

#492 in No standard library

Download history 12/week @ 2026-01-16 17/week @ 2026-01-23 16/week @ 2026-01-30 15/week @ 2026-02-06 5/week @ 2026-02-13 19/week @ 2026-02-20 11/week @ 2026-02-27 20/week @ 2026-03-06 23/week @ 2026-03-13 45/week @ 2026-03-20 29/week @ 2026-03-27 26/week @ 2026-04-03 30/week @ 2026-04-10 16/week @ 2026-04-17 6/week @ 2026-04-24 76/week @ 2026-05-01

132 downloads per month
Used in 7 crates (3 directly)

MIT license

13KB
194 lines

Adds array_chunks on stable. This used to be a nightly feature, now its a crate.

This is just a wrapper so you dont have to write x.as_chunks::<N>().0.into_iter().


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);

No runtime deps

Features