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,
    },
}
Expand description

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.

Show fields

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.

Show fields

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.

Implementations

Returns the contained Ok value, consuming the self value.

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Creates a value from an iterator. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.