#slice #chunks #iterator #chunk-size

rchunks

Iterator for slices similar to .chunks() but starting from the back of the slice and moving towards the front. Differs from .chunks().rev() in handling cases where the slice is not a multiple of chunk size.

5 releases

Uses old Rust 2015

0.1.4 Sep 9, 2017
0.1.3 Sep 9, 2017
0.1.2 Sep 9, 2017
0.1.1 Sep 9, 2017
0.1.0 Sep 9, 2017

#2928 in Rust patterns

MIT license

11KB
189 lines

RChunks

(Reverse- or Right-) chunk producer for slices.

Feature requests, additional tests or documentation, or other pull requests are welcome.


lib.rs:

rchunks - a simple method for right-to-left non-overlapping windows of a slice.

This crate's methods differ from .chunks().rev() in how it handles slices that are not a multiple of the chunk size: with .chunks().rev() the smaller lot will come from the end of the slice, whereas with .rchunks() the smaller lot will come from the beginning.

To use this crate, import the RChunks trait.

use rchunks::RChunks;

No runtime deps