Trait predicates::prelude::Predicate
source · pub trait Predicate<Item>: PredicateReflectionwhere
Item: ?Sized,{
// Required method
fn eval(&self, variable: &Item) -> bool;
// Provided method
fn find_case<'a>(
&'a self,
expected: bool,
variable: &Item,
) -> Option<Case<'a>> { ... }
}
Expand description
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§
Provided Methods§
Implementors§
impl Predicate<f64> for IsClosePredicate
Available on crate feature
float-cmp
only.impl Predicate<str> for StrFilePredicate
impl Predicate<str> for ContainsPredicate
impl Predicate<str> for DifferencePredicate
Available on crate feature
diff
only.impl Predicate<str> for EndsWithPredicate
impl Predicate<str> for IsEmptyPredicate
impl Predicate<str> for MatchesPredicate
impl Predicate<str> for RegexPredicate
Available on crate feature
regex
only.impl Predicate<str> for StartsWithPredicate
impl Predicate<Path> for BinaryFilePredicate
impl Predicate<Path> for ExistencePredicate
impl Predicate<Path> for FileTypePredicate
impl Predicate<Path> for StrFilePredicate
impl Predicate<[u8]> for BinaryFilePredicate
impl<F, T> Predicate<T> for FnPredicate<F, T>
impl<Item> Predicate<Item> for BoxPredicate<Item>where
Item: ?Sized,
impl<Item: ?Sized> Predicate<Item> for BooleanPredicate
impl<M1, M2, Item> Predicate<Item> for AndPredicate<M1, M2, Item>
impl<M1, M2, Item> Predicate<Item> for OrPredicate<M1, M2, Item>
impl<M, Item> Predicate<Item> for NotPredicate<M, Item>
impl<M, Item> Predicate<Item> for NamePredicate<M, Item>
impl<P> Predicate<str> for NormalizedPredicate<P>
Available on crate feature
normalize-line-endings
only.