[−]Trait mockall::Predicate
Trait for generically evaluating a type against a dynamically created predicate function.
The exact meaning of eval
depends on the situation, but will usually
mean that the evaluated item is in some sort of pre-defined set. This is
different from Ord
and Eq
in that an item
will almost never be the
same type as the implementing Predicate
type.
Required methods
fn eval(&self, variable: &Item) -> bool
Execute this Predicate
against variable
, returning the resulting
boolean.
Provided methods
fn find_case(&'a self, expected: bool, variable: &Item) -> Option<Case<'a>>
Find a case that proves this predicate as expected
when run against variable
.
Implementations on Foreign Types
impl<T> Predicate<T> for OrdPredicate<T> where
T: Debug + PartialOrd<T>,
[src]
T: Debug + PartialOrd<T>,
fn eval(&self, variable: &T) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &T) -> Option<Case<'a>>
[src]
impl<P> Predicate<Path> for FileContentPredicate<P> where
P: Predicate<[u8]>,
[src]
P: Predicate<[u8]>,
fn eval(&self, path: &Path) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &Path) -> Option<Case<'a>>
[src]
impl<P> Predicate<[u8]> for Utf8Predicate<P> where
P: Predicate<str>,
[src]
P: Predicate<str>,
fn eval(&self, variable: &[u8]) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &[u8]) -> Option<Case<'a>>
[src]
impl<M1, M2, Item> Predicate<Item> for OrPredicate<M1, M2, Item> where
Item: ?Sized,
M1: Predicate<Item>,
M2: Predicate<Item>,
[src]
Item: ?Sized,
M1: Predicate<Item>,
M2: Predicate<Item>,
fn eval(&self, item: &Item) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &Item) -> Option<Case<'a>>
[src]
impl Predicate<f64> for IsClosePredicate
[src]
fn eval(&self, variable: &f64) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &f64) -> Option<Case<'a>>
[src]
impl Predicate<str> for IsEmptyPredicate
[src]
fn eval(&self, variable: &str) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &str) -> Option<Case<'a>>
[src]
impl<M1, M2, Item> Predicate<Item> for AndPredicate<M1, M2, Item> where
Item: ?Sized,
M1: Predicate<Item>,
M2: Predicate<Item>,
[src]
Item: ?Sized,
M1: Predicate<Item>,
M2: Predicate<Item>,
fn eval(&self, item: &Item) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &Item) -> Option<Case<'a>>
[src]
impl<Item> Predicate<Item> for BoxPredicate<Item> where
Item: ?Sized,
[src]
Item: ?Sized,
fn eval(&self, variable: &Item) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &Item) -> Option<Case<'a>>
[src]
impl Predicate<Path> for BinaryFilePredicate
[src]
fn eval(&self, path: &Path) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &Path) -> Option<Case<'a>>
[src]
impl<'a, T> Predicate<T> for OrdPredicate<&'a T> where
T: Debug + PartialOrd<T> + ?Sized,
[src]
T: Debug + PartialOrd<T> + ?Sized,
fn eval(&self, variable: &T) -> bool
[src]
fn find_case(&'b self, expected: bool, variable: &T) -> Option<Case<'b>>
[src]
impl<F, T> Predicate<T> for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
[src]
F: Fn(&T) -> bool,
T: ?Sized,
fn eval(&self, variable: &T) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &T) -> Option<Case<'a>>
[src]
impl Predicate<str> for DifferencePredicate
[src]
fn eval(&self, edit: &str) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &str) -> Option<Case<'a>>
[src]
impl Predicate<str> for ContainsPredicate
[src]
fn eval(&self, variable: &str) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &str) -> Option<Case<'a>>
[src]
impl Predicate<Path> for StrFilePredicate
[src]
fn eval(&self, path: &Path) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &Path) -> Option<Case<'a>>
[src]
impl<T> Predicate<T> for InPredicate<T> where
T: PartialEq<T> + Debug,
[src]
T: PartialEq<T> + Debug,
fn eval(&self, variable: &T) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &T) -> Option<Case<'a>>
[src]
impl Predicate<str> for RegexPredicate
[src]
fn eval(&self, variable: &str) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &str) -> Option<Case<'a>>
[src]
impl Predicate<str> for MatchesPredicate
[src]
fn eval(&self, variable: &str) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &str) -> Option<Case<'a>>
[src]
impl<M, Item> Predicate<Item> for NamePredicate<M, Item> where
Item: ?Sized,
M: Predicate<Item>,
[src]
Item: ?Sized,
M: Predicate<Item>,
fn eval(&self, item: &Item) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &Item) -> Option<Case<'a>>
[src]
impl<P> Predicate<str> for TrimPredicate<P> where
P: Predicate<str>,
[src]
P: Predicate<str>,
fn eval(&self, variable: &str) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &str) -> Option<Case<'a>>
[src]
impl Predicate<str> for StartsWithPredicate
[src]
fn eval(&self, variable: &str) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &str) -> Option<Case<'a>>
[src]
impl Predicate<str> for StrFilePredicate
[src]
fn eval(&self, actual: &str) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &str) -> Option<Case<'a>>
[src]
impl Predicate<[u8]> for BinaryFilePredicate
[src]
fn eval(&self, actual: &[u8]) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &[u8]) -> Option<Case<'a>>
[src]
impl<M, Item> Predicate<Item> for NotPredicate<M, Item> where
Item: ?Sized,
M: Predicate<Item>,
[src]
Item: ?Sized,
M: Predicate<Item>,
fn eval(&self, item: &Item) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &Item) -> Option<Case<'a>>
[src]
impl<'a, T> Predicate<T> for HashableInPredicate<&'a T> where
T: Hash + Eq + Debug + ?Sized,
[src]
T: Hash + Eq + Debug + ?Sized,
fn eval(&self, variable: &T) -> bool
[src]
fn find_case(&'b self, expected: bool, variable: &T) -> Option<Case<'b>>
[src]
impl<T> Predicate<T> for EqPredicate<T> where
T: Debug + PartialEq<T>,
[src]
T: Debug + PartialEq<T>,
fn eval(&self, variable: &T) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &T) -> Option<Case<'a>>
[src]
impl Predicate<Path> for ExistencePredicate
[src]
fn eval(&self, path: &Path) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &Path) -> Option<Case<'a>>
[src]
impl<Item> Predicate<Item> for BooleanPredicate where
Item: ?Sized,
[src]
Item: ?Sized,
fn eval(&self, _variable: &Item) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &Item) -> Option<Case<'a>>
[src]
impl<'a, T> Predicate<T> for OrdInPredicate<&'a T> where
T: Ord + Debug + ?Sized,
[src]
T: Ord + Debug + ?Sized,
fn eval(&self, variable: &T) -> bool
[src]
fn find_case(&'b self, expected: bool, variable: &T) -> Option<Case<'b>>
[src]
impl<P> Predicate<OsStr> for Utf8Predicate<P> where
P: Predicate<str>,
[src]
P: Predicate<str>,
fn eval(&self, variable: &OsStr) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &OsStr) -> Option<Case<'a>>
[src]
impl<P> Predicate<str> for NormalizedPredicate<P> where
P: Predicate<str>,
[src]
P: Predicate<str>,
fn eval(&self, variable: &str) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &str) -> Option<Case<'a>>
[src]
impl<'a, T> Predicate<T> for InPredicate<&'a T> where
T: PartialEq<T> + Debug + ?Sized,
[src]
T: PartialEq<T> + Debug + ?Sized,
fn eval(&self, variable: &T) -> bool
[src]
fn find_case(&'b self, expected: bool, variable: &T) -> Option<Case<'b>>
[src]
impl<T> Predicate<T> for OrdInPredicate<T> where
T: Ord + Debug,
[src]
T: Ord + Debug,
fn eval(&self, variable: &T) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &T) -> Option<Case<'a>>
[src]
impl Predicate<str> for EndsWithPredicate
[src]
fn eval(&self, variable: &str) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &str) -> Option<Case<'a>>
[src]
impl<T> Predicate<T> for HashableInPredicate<T> where
T: Hash + Eq + Debug,
[src]
T: Hash + Eq + Debug,
fn eval(&self, variable: &T) -> bool
[src]
fn find_case(&'a self, expected: bool, variable: &T) -> Option<Case<'a>>
[src]
impl<'a, T> Predicate<T> for EqPredicate<&'a T> where
T: Debug + PartialEq<T> + ?Sized,
[src]
T: Debug + PartialEq<T> + ?Sized,