Trait BoolUtils

Source
pub trait BoolUtils {
    // Required methods
    fn not(&self) -> bool;
    fn then_val<T>(&self, val: T) -> Option<T>;
    fn if_true<T, F: FnOnce() -> T>(&self, f: F) -> Option<T>;
    fn if_false<T, F: FnOnce() -> T>(&self, f: F) -> Option<T>;
    fn toggle(&mut self);
}

Required Methods§

Source

fn not(&self) -> bool

Source

fn then_val<T>(&self, val: T) -> Option<T>

Source

fn if_true<T, F: FnOnce() -> T>(&self, f: F) -> Option<T>

Source

fn if_false<T, F: FnOnce() -> T>(&self, f: F) -> Option<T>

Source

fn toggle(&mut self)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl BoolUtils for bool

Source§

fn not(&self) -> bool

Source§

fn then_val<T>(&self, val: T) -> Option<T>

Source§

fn if_true<T, F: FnOnce() -> T>(&self, f: F) -> Option<T>

Source§

fn if_false<T, F: FnOnce() -> T>(&self, f: F) -> Option<T>

Source§

fn toggle(&mut self)

Implementors§