[][src]Trait predicates_core::Predicate

pub trait Predicate<Item: ?Sized>: PredicateReflection {
    pub fn eval(&self, variable: &Item) -> bool;

    pub fn find_case<'a>(
        &'a self,
        expected: bool,
        variable: &Item
    ) -> Option<Case<'a>> { ... } }

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

pub fn eval(&self, variable: &Item) -> bool[src]

Execute this Predicate against variable, returning the resulting boolean.

Loading content...

Provided methods

pub fn find_case<'a>(
    &'a self,
    expected: bool,
    variable: &Item
) -> Option<Case<'a>>
[src]

Find a case that proves this predicate as expected when run against variable.

Loading content...

Implementors

Loading content...