Crates.io | array_chunks |
lib.rs | array_chunks |
version | 1.0.0 |
created_at | 2025-07-31 05:47:13.61296+00 |
updated_at | 2025-07-31 05:47:13.61296+00 |
description | adds array_chunks back in |
homepage | |
repository | https://github.com/bend-n/atools |
max_upload_size | |
id | 1774426 |
size | 13,272 |
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);