Enum collect_array::CollectArrayResult[][src]

pub enum CollectArrayResult<T, const N: usize> {
    Ok([T; N]),
    TooManyElements {
        values: [T; N],
        next_value: T,
    NotEnoughElements {
        values: [MaybeUninit<T>; N],
        init_count: usize,

The result of collecting an Iterator into an exactly-sized array, or having failed to.

More than N elements may be consumed from the Iterator - if this is undesirable, consider calling Iterator before collecting.


Ok([T; N])

Returned if the Iterator contained exactly N elements.


Returned if the Iterator contained more than N elements. The underlying Iterator may not be exhausted, and remaining values may not be accessible.

Fields of TooManyElements

values: [T; N]

The N values which were read.

next_value: T

The next value after the Nth.


Returned if the Iterator contained fewer than N elements.


Only the first init_count elements will be init, the remaining elements must not be read.

Fields of NotEnoughElements

values: [MaybeUninit<T>; N]

The consumed values, only init_count of which will be init.

init_count: usize

How many elements in values are init.

Trait Implementations

impl<T, const N: usize> Debug for CollectArrayResult<T, N> where
    T: Debug

impl<T, const N: usize> FromIterator<T> for CollectArrayResult<T, N>[src]

impl<T, const N: usize> PartialEq<CollectArrayResult<T, N>> for CollectArrayResult<T, N> where
    T: PartialEq

Auto Trait Implementations

impl<T, const N: usize> Send for CollectArrayResult<T, N> where
    T: Send

impl<T, const N: usize> Sync for CollectArrayResult<T, N> where
    T: Sync

impl<T, const N: usize> Unpin for CollectArrayResult<T, N> where
    T: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.