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
MaybeUninhabited::Inhabited
, MaybeUninhabited::Uninhabited
otherwise.
Source§impl MaybeUninhabited
impl MaybeUninhabited
Sourcepub const fn map<T: Copy>(self, v: T) -> MaybeUninhabited<T>
pub const fn map<T: Copy>(self, v: T) -> MaybeUninhabited<T>
Maps a MaybeUninhabited::Inhabited
to a
MaybeUninhabited<T>::Inhabited
with the value v
or returns
MaybeUninhabited<T>::Uninhabited
.
Sourcepub const fn and(self, other: Self) -> Self
pub const fn and(self, other: Self) -> Self
Returns the logical and between self
and other
.
The result is MaybeUninhabited::Inhabited
iff both self
and
other
are MaybeUninhabited::Inhabited
,
MaybeUninhabited::Uninhabited
otherwise.
Sourcepub const fn or(self, b: Self) -> Self
pub const fn or(self, b: Self) -> Self
Returns the or and between self
and other
.
The result is MaybeUninhabited::Uninhabited
iff both self
and
other
are MaybeUninhabited::Uninhabited
,
MaybeUninhabited::Inhabited
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>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more