pub enum MaybeUninhabited<T> {
Uninhabited,
Inhabited(T),
}Expand description
Optional value that exists if some other type is inhabited.
Variants§
Uninhabited
The type is uninhabited, no value.
Inhabited(T)
The type is inhabited,
some value of type T.
Implementations§
Source§impl<T: Copy> MaybeUninhabited<T>
impl<T: Copy> MaybeUninhabited<T>
Sourcepub const fn new<U: TypeLayout>(v: T) -> Self
pub const fn new<U: TypeLayout>(v: T) -> Self
Construct MaybeUninhabited::Inhabited iff <U as TypeLayout>::Inhabited is
inhabited::Inhabited, MaybeUninhabited::Uninhabited
otherwise.
Trait Implementations§
Source§impl<T: Clone> Clone for MaybeUninhabited<T>
impl<T: Clone> Clone for MaybeUninhabited<T>
Source§fn clone(&self) -> MaybeUninhabited<T>
fn clone(&self) -> MaybeUninhabited<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for MaybeUninhabited<T>
impl<T: Debug> Debug for MaybeUninhabited<T>
Source§impl<T: Default> Default for MaybeUninhabited<T>
impl<T: Default> Default for MaybeUninhabited<T>
Source§impl<'de, T> Deserialize<'de> for MaybeUninhabited<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for MaybeUninhabited<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: Hash> Hash for MaybeUninhabited<T>
impl<T: Hash> Hash for MaybeUninhabited<T>
Source§impl<T: Ord> Ord for MaybeUninhabited<T>
impl<T: Ord> Ord for MaybeUninhabited<T>
Source§fn cmp(&self, other: &MaybeUninhabited<T>) -> Ordering
fn cmp(&self, other: &MaybeUninhabited<T>) -> Ordering
1.21.0 · 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 MaybeUninhabited<T>
impl<T: PartialEq> PartialEq for MaybeUninhabited<T>
Source§impl<T: PartialOrd> PartialOrd for MaybeUninhabited<T>
impl<T: PartialOrd> PartialOrd for MaybeUninhabited<T>
Source§impl<T> Serialize for MaybeUninhabited<T>where
T: Serialize,
impl<T> Serialize for MaybeUninhabited<T>where
T: Serialize,
impl<T: Copy> Copy for MaybeUninhabited<T>
impl<T: Eq> Eq for MaybeUninhabited<T>
impl<T> StructuralPartialEq for MaybeUninhabited<T>
Auto Trait Implementations§
impl<T> Freeze for MaybeUninhabited<T>where
T: Freeze,
impl<T> RefUnwindSafe for MaybeUninhabited<T>where
T: RefUnwindSafe,
impl<T> Send for MaybeUninhabited<T>where
T: Send,
impl<T> Sync for MaybeUninhabited<T>where
T: Sync,
impl<T> Unpin for MaybeUninhabited<T>where
T: Unpin,
impl<T> UnwindSafe for MaybeUninhabited<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<T> ExtractDiscriminant for T
impl<T> ExtractDiscriminant for T
Source§type Discriminant = <T as ExtractDiscriminantSpec<<T as DiscriminantKind>::Discriminant>>::Ty
type Discriminant = <T as ExtractDiscriminantSpec<<T as DiscriminantKind>::Discriminant>>::Ty
The type of the discriminant, which must satisfy the trait bounds
required by
core::mem::Discriminant. Read more