Function brownstone::build_iter[][src]

pub fn build_iter<I: IntoIterator, const N: usize>(iterator: I) -> [I::Item; N]
Expand description

Build a fixed-size array from an iterator. The first N elements of the iterator are collected into an array of length N.

Panics

Panics if the iterator doesn’t yield enough elements

Example

let array: [i32; 5] = brownstone::build_iter(1..);
assert_eq!(array, [1, 2, 3, 4, 5]);