pub struct Flag(/* private fields */);Expand description
Universal boolean flag with explicit enable/disable semantics.
Flag::enabled() ─► is_enabled() == true
Flag::disabled() ─► is_enabled() == false
Flag::default() ─► enabled (opt-in disable)use solti_model::Flag;
let f = Flag::enabled();
assert!(f.is_enabled());
let f: Flag = false.into();
assert!(f.is_disabled());
let b: bool = f.into();
assert!(!b);Implementations§
Source§impl Flag
impl Flag
Sourcepub const fn is_enabled(&self) -> bool
pub const fn is_enabled(&self) -> bool
Check if the flag is enabled.
Sourcepub const fn is_disabled(&self) -> bool
pub const fn is_disabled(&self) -> bool
Check if the flag is disabled.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Flag
impl<'de> Deserialize<'de> for Flag
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
impl Copy for Flag
impl Eq for Flag
impl StructuralPartialEq for Flag
Auto Trait Implementations§
impl Freeze for Flag
impl RefUnwindSafe for Flag
impl Send for Flag
impl Sync for Flag
impl Unpin for Flag
impl UnsafeUnpin for Flag
impl UnwindSafe for Flag
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