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.
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
§
values: [MaybeUninit<T>; N]
The consumed values, only init_count
of which will be init.
Implementations§
Trait Implementations§
Source§impl<T, const N: usize> Drop for CollectArrayResult<T, N>
impl<T, const N: usize> Drop for CollectArrayResult<T, N>
Source§impl<T, const N: usize> FromIterator<T> for CollectArrayResult<T, N>
impl<T, const N: usize> FromIterator<T> for CollectArrayResult<T, N>
Source§fn from_iter<It: IntoIterator<Item = T>>(it: It) -> Self
fn from_iter<It: IntoIterator<Item = T>>(it: It) -> Self
Creates a value from an iterator. Read more
Auto Trait Implementations§
impl<T, const N: usize> Freeze for CollectArrayResult<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for CollectArrayResult<T, N>where
T: RefUnwindSafe,
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,
impl<T, const N: usize> UnwindSafe for CollectArrayResult<T, N>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more