adds array_chunks back, after it was taken from us
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..d996b89 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +### After array_chunks was brutally taken from us in [#143289](https://github.com/rust-lang/rust/pull/143289/files), I have taken it upon myself to diligently add it back to rust. + + + + +An iterator over a slice in (non-overlapping) chunks (`N` elements at a time), starting at the beginning of the slice. + +```rust +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); +``` |