Skip to main content

array_from_iterator

Function array_from_iterator 

Source
pub(crate) fn array_from_iterator<I, T, E, const N: usize>(
    iter: I,
    expected: &dyn Expected,
) -> Result<[T; N], E>
where I: Iterator<Item = Result<T, E>>, E: DeError,
Expand description

Collect an array of a fixed size from an iterator.

ยงSafety

The code follow exactly the pattern of initializing an array element-by-element from the standard library. https://doc.rust-lang.org/nightly/std/mem/union.MaybeUninit.html#initializing-an-array-element-by-element