pub enum OneOrMany<T> {
One(T),
Many(Vec<T>),
}Variants§
Implementations§
Source§impl<T> OneOrMany<T>
impl<T> OneOrMany<T>
pub fn map<U, F>(self, f: F) -> OneOrMany<U>where
F: Fn(T) -> U,
pub fn extend<Iter>(self, other: Iter) -> Selfwhere
Iter: IntoIterator<Item = T>,
pub fn contains(&self, item: &T) -> boolwhere
T: PartialEq,
pub fn len(&self) -> usize
pub fn is_one(&self) -> bool
pub fn is_many(&self) -> bool
pub fn into_vec(self) -> Vec<T>
pub fn iter(&self) -> Iter<'_, T>
Trait Implementations§
Source§impl<T> BorrowMut<[T]> for OneOrMany<T>
impl<T> BorrowMut<[T]> for OneOrMany<T>
Source§fn borrow_mut(&mut self) -> &mut [T]
fn borrow_mut(&mut self) -> &mut [T]
Mutably borrows from an owned value. Read more
Source§impl<'de, T> Deserialize<'de> for OneOrMany<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for OneOrMany<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> FromIterator<T> for OneOrMany<T>
impl<T> FromIterator<T> for OneOrMany<T>
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<'a, T> IntoIterator for &'a OneOrMany<T>
impl<'a, T> IntoIterator for &'a OneOrMany<T>
Source§impl<'a, T> IntoIterator for &'a mut OneOrMany<T>
impl<'a, T> IntoIterator for &'a mut OneOrMany<T>
Source§impl<T> IntoIterator for OneOrMany<T>
impl<T> IntoIterator for OneOrMany<T>
Source§impl<T: Ord> Ord for OneOrMany<T>
impl<T: Ord> Ord for OneOrMany<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialEq> PartialEq for OneOrMany<T>
impl<T: PartialEq> PartialEq for OneOrMany<T>
Source§impl<T: PartialOrd> PartialOrd for OneOrMany<T>
impl<T: PartialOrd> PartialOrd for OneOrMany<T>
impl<T: Eq> Eq for OneOrMany<T>
impl<T> StructuralPartialEq for OneOrMany<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Upper case
letters are used (e.g. F9B4CA)