Crate arrays

source ·
Expand description

Collect an iterator into an array

Getting started

Add the arrays crate to your Cargo manifest.

cargo add arrays

Now collect any iterator into an array.

let arr: [_; 3] = arrays::collect(iter).unwrap();

Functions

Consumes N elements from the iterator and returns them as an array. If the iterator yields fewer than N items, None is returned and all already yielded items are dropped.