pub enum Boolean {
False,
True,
}Expand description
Enum with two possible values: True or False which represent the logical
values true and false respectively.
Variants§
Implementations§
Source§impl Boolean
impl Boolean
Sourcepub fn new(value: bool) -> Self
pub fn new(value: bool) -> Self
Creates a Boolean based on the given primitive bool.
If the value is true, it will return Boolean::True and
if the value isfalse will return Boolean::False
Sourcepub fn implication<R: Into<Self>>(self, rhs: R) -> Self
pub fn implication<R: Into<Self>>(self, rhs: R) -> Self
Sourcepub fn equivalence<R: Into<Self>>(self, rhs: R) -> Self
pub fn equivalence<R: Into<Self>>(self, rhs: R) -> Self
pub fn is_true(self) -> bool
pub fn is_false(self) -> bool
pub fn then_some<T>(self, then: T) -> Option<T>
pub fn then<T>(self, f: impl FnOnce() -> T) -> Option<T>
Trait Implementations§
Source§impl BitAndAssign for Boolean
impl BitAndAssign for Boolean
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the
&= operation. Read moreSource§impl BitOrAssign for Boolean
impl BitOrAssign for Boolean
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|= operation. Read moreSource§impl BitXorAssign for Boolean
impl BitXorAssign for Boolean
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
Performs the
^= operation. Read moreSource§impl FromStr for Boolean
impl FromStr for Boolean
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Important: if the crate has the alloc crate is available and the ‘has_alloc’ feature is enabled, it allows for a “true” or “false” value with any casing (e.g. “True” or “trUE” are equivalent to “true”). If the feature ‘has_alloc’ is set to false, only the values “true”, “True”, “TRUE”, “false”, “False” and “FALSE” will be accepted as valid inputs.
Source§type Err = BooleanError
type Err = BooleanError
The associated error which can be returned from parsing.
Source§impl Ord for Boolean
impl Ord for Boolean
Source§impl PartialOrd for Boolean
impl PartialOrd for Boolean
impl Copy for Boolean
impl Eq for Boolean
impl StructuralPartialEq for Boolean
Auto Trait Implementations§
impl Freeze for Boolean
impl RefUnwindSafe for Boolean
impl Send for Boolean
impl Sync for Boolean
impl Unpin for Boolean
impl UnwindSafe for Boolean
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