Trait mockall::PredicateBooleanExt[][src]

pub trait PredicateBooleanExt<Item>: Predicate<Item> where
    Item: ?Sized
{ pub fn and<B>(self, other: B) -> AndPredicate<Self, B, Item>
    where
        B: Predicate<Item>
, { ... }
pub fn or<B>(self, other: B) -> OrPredicate<Self, B, Item>
    where
        B: Predicate<Item>
, { ... }
pub fn not(self) -> NotPredicate<Self, Item> { ... } }

Predicate extension that adds boolean logic.

Provided methods

pub fn and<B>(self, other: B) -> AndPredicate<Self, B, Item> where
    B: Predicate<Item>, 
[src]

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));

pub fn or<B>(self, other: B) -> OrPredicate<Self, B, Item> where
    B: Predicate<Item>, 
[src]

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));

pub fn not(self) -> NotPredicate<Self, Item>[src]

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));
Loading content...

Implementors

impl<P, Item> PredicateBooleanExt<Item> for P where
    Item: ?Sized,
    P: Predicate<Item>, 
[src]

Loading content...