BoolExt

Trait BoolExt 

Source
pub trait BoolExt {
    // Required methods
    fn implies(self, other: Self) -> Self;
    fn implied_by(self, other: Self) -> Self;
}
Expand description

Extensions for bool.

See also ACP #188

Required Methods§

Source

fn implies(self, other: Self) -> Self

Logical implication, equivalent to !self || other.

assert!(false.implies(false));
assert!(false.implies(true));
assert!(!true.implies(false));
assert!(true.implies(true));
Source

fn implied_by(self, other: Self) -> Self

Inverse of .implies().

assert!(false.implied_by(false));
assert!(!false.implied_by(true));
assert!(true.implied_by(false));
assert!(true.implied_by(true));

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 BoolExt for bool

Source§

fn implies(self, other: Self) -> Self

Source§

fn implied_by(self, other: Self) -> Self

Implementors§