chunk
Splits iter into consecutive chunks of size items, the last one possibly shorter.
Unlike slice::chunks,
this consumes any IntoIterator, not just a slice, and owns the items instead of borrowing
them, so it also works on a lazily-generated or single-use iterator. A size of 0 produces
no chunks at all, since a non-empty chunk cannot hold zero items.
Import
Section titled “Import”Cargo feature iter (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
iter | I | The items to split. |
size | usize | How many items go in each chunk. |
Returns
Section titled “Returns”Vec<Vec<I::Item>> — The chunks, in order.
