pub enum OneOrCollection<T> {
One(T),
Collection(T),
}Expand description
One item or collection of items for types.
This is common construction in compiler when we need to describe singleton or collection of items of specific type.
Variants§
Implementations§
Source§impl<'a> OneOrCollection<(TypeInfo, QualifiedName<'a>)>
impl<'a> OneOrCollection<(TypeInfo, QualifiedName<'a>)>
Sourcepub const fn name(&self) -> QualifiedName<'a>
pub const fn name(&self) -> QualifiedName<'a>
Qualified type name of the property.
Source§impl<'a> OneOrCollection<QualifiedName<'a>>
impl<'a> OneOrCollection<QualifiedName<'a>>
Sourcepub const fn name(&self) -> QualifiedName<'a>
pub const fn name(&self) -> QualifiedName<'a>
Qualified type name of the property.
Source§impl OneOrCollection<TaggedType<QualifiedName, QualifiedTypeNameTag>>
impl OneOrCollection<TaggedType<QualifiedName, QualifiedTypeNameTag>>
pub const fn qualified_type_name(&self) -> &QualifiedTypeName
Source§impl<T> OneOrCollection<T>
impl<T> OneOrCollection<T>
Sourcepub fn map<F, R>(self, f: F) -> OneOrCollection<R>where
F: FnOnce(T) -> R,
pub fn map<F, R>(self, f: F) -> OneOrCollection<R>where
F: FnOnce(T) -> R,
Maps inner value with funciton f.
Sourcepub const fn as_ref(&self) -> OneOrCollection<&T>
pub const fn as_ref(&self) -> OneOrCollection<&T>
Convert from OneOrCollection<T> to OneOrCollection<&T>.
Trait Implementations§
Source§impl<T: Clone> Clone for OneOrCollection<T>
impl<T: Clone> Clone for OneOrCollection<T>
Source§impl<T: Debug> Debug for OneOrCollection<T>
impl<T: Debug> Debug for OneOrCollection<T>
Source§impl<T: PartialEq> PartialEq for OneOrCollection<T>
impl<T: PartialEq> PartialEq for OneOrCollection<T>
impl<T: Copy> Copy for OneOrCollection<T>
impl<T: Eq> Eq for OneOrCollection<T>
Auto Trait Implementations§
impl<T> Freeze for OneOrCollection<T>where
T: Freeze,
impl<T> RefUnwindSafe for OneOrCollection<T>where
T: RefUnwindSafe,
impl<T> Send for OneOrCollection<T>where
T: Send,
impl<T> Sync for OneOrCollection<T>where
T: Sync,
impl<T> Unpin for OneOrCollection<T>where
T: Unpin,
impl<T> UnsafeUnpin for OneOrCollection<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for OneOrCollection<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