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.

Variants

Ok([T; N])

Returned if the Iterator contained exactly N elements.

TooManyElements

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.

NotEnoughElements

Returned if the Iterator contained fewer than N elements.

Safety

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
[src]

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
[src]

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
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.