Trait predicates::boolean::PredicateBooleanExt [−][src]
pub trait PredicateBooleanExt<Item: ?Sized> where
Self: Predicate<Item>, { fn and<B>(self, other: B) -> AndPredicate<Self, B, Item>
where
B: Predicate<Item>,
Self: Sized, { ... } fn or<B>(self, other: B) -> OrPredicate<Self, B, Item>
where
B: Predicate<Item>,
Self: Sized, { ... } fn not(self) -> NotPredicate<Self, Item>
where
Self: Sized, { ... } }
Predicate
extension that adds boolean logic.
Provided methods
fn and<B>(self, other: B) -> AndPredicate<Self, B, Item> where
B: Predicate<Item>,
Self: Sized,
[src]
B: Predicate<Item>,
Self: Sized,
Compute the logical AND of two Predicate
results, returning the result.
Examples
use predicates::prelude::*; let predicate_fn1 = predicate::always().and(predicate::always()); let predicate_fn2 = predicate::always().and(predicate::never()); assert_eq!(true, predicate_fn1.eval(&4)); assert_eq!(false, predicate_fn2.eval(&4));
fn or<B>(self, other: B) -> OrPredicate<Self, B, Item> where
B: Predicate<Item>,
Self: Sized,
[src]
B: Predicate<Item>,
Self: Sized,
Compute the logical OR of two Predicate
results, returning the result.
Examples
use predicates::prelude::*; let predicate_fn1 = predicate::always().or(predicate::always()); let predicate_fn2 = predicate::always().or(predicate::never()); let predicate_fn3 = predicate::never().or(predicate::never()); assert_eq!(true, predicate_fn1.eval(&4)); assert_eq!(true, predicate_fn2.eval(&4)); assert_eq!(false, predicate_fn3.eval(&4));
fn not(self) -> NotPredicate<Self, Item> where
Self: Sized,
[src]
Self: Sized,
Compute the logical NOT of a Predicate
, returning the result.
Examples
use predicates::prelude::*; let predicate_fn1 = predicate::always().not(); let predicate_fn2 = predicate::never().not(); assert_eq!(false, predicate_fn1.eval(&4)); assert_eq!(true, predicate_fn2.eval(&4));
Implementors
impl<P, Item> PredicateBooleanExt<Item> for P where
P: Predicate<Item>,
Item: ?Sized,
[src]
impl<P, Item> PredicateBooleanExt<Item> for P where
P: Predicate<Item>,
Item: ?Sized,
[src]