Trait imply_option::ImplyOption [−][src]
pub trait ImplyOption<T: Sized>: Sized + PartialEq<bool> { fn then(self, value: T) -> Option<T> { ... } fn then_do(
self,
value: impl FnOnce() -> T
) -> Option<T> { ... } }
Allows construction of an Option<T>
based on a bool
.
Provided Methods
fn then(self, value: T) -> Option<T>
If self == true
returns Some(value)
.
fn then_do(
self,
value: impl FnOnce() -> T
) -> Option<T>
self,
value: impl FnOnce() -> T
) -> Option<T>
If self == true
returns Some(value)
where value
is lazily constructed.