enum OneOrMany<T> {
One(T),
Many(Vec<T>),
}Expand description
Stores either one item inline or multiple items in a vector.
Variants§
Implementations§
Source§impl<T> OneOrMany<T>
impl<T> OneOrMany<T>
Sourcefn from_exact_iter(items: impl ExactSizeIterator<Item = T>) -> Self
fn from_exact_iter(items: impl ExactSizeIterator<Item = T>) -> Self
Collects an exact-size iterator, storing its sole item inline when possible.
Sourcefn unzip_exact<U>(
items: impl ExactSizeIterator<Item = (T, U)>,
) -> (Self, OneOrMany<U>)
fn unzip_exact<U>( items: impl ExactSizeIterator<Item = (T, U)>, ) -> (Self, OneOrMany<U>)
Unzips an exact-size iterator, storing sole items inline when possible.
Auto Trait Implementations§
impl<T> Freeze for OneOrMany<T>where
T: Freeze,
impl<T> RefUnwindSafe for OneOrMany<T>where
T: RefUnwindSafe,
impl<T> Send for OneOrMany<T>where
T: Send,
impl<T> Sync for OneOrMany<T>where
T: Sync,
impl<T> Unpin for OneOrMany<T>where
T: Unpin,
impl<T> UnsafeUnpin for OneOrMany<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for OneOrMany<T>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