BoolTrait
Fully qualified path: core::boolean::BoolTrait
pub trait BoolTrait<T, +Drop<T>>
Trait functions
then_some
Returns Some(t)
if the bool
is true
, None
otherwise. # Examples
assert!(false.then_some(0) == None);
assert!(true.then_some(0) == Some(0));
Fully qualified path: core::boolean::BoolTrait::then_some
fn then_some(self: bool, t: T) -> Option<T> nopanic