Skip to main content

Specification

Trait Specification 

Source
pub trait Specification<T>: Send + Sync {
    // Required method
    fn is_satisfied_by(&self, t: &T) -> bool;

    // Provided methods
    fn and<S>(self, other: S) -> AndSpec<Self, S>
       where Self: Sized,
             S: Specification<T> { ... }
    fn or<S>(self, other: S) -> OrSpec<Self, S>
       where Self: Sized,
             S: Specification<T> { ... }
    fn not(self) -> NotSpec<Self>
       where Self: Sized { ... }
}
Expand description

Composable predicate over T.

Required Methods§

Source

fn is_satisfied_by(&self, t: &T) -> bool

Provided Methods§

Source

fn and<S>(self, other: S) -> AndSpec<Self, S>
where Self: Sized, S: Specification<T>,

Source

fn or<S>(self, other: S) -> OrSpec<Self, S>
where Self: Sized, S: Specification<T>,

Source

fn not(self) -> NotSpec<Self>
where Self: Sized,

Implementors§

Source§

impl<T, A: Specification<T>, B: Specification<T>> Specification<T> for AndSpec<A, B>

Source§

impl<T, A: Specification<T>, B: Specification<T>> Specification<T> for OrSpec<A, B>

Source§

impl<T, F: Fn(&T) -> bool + Send + Sync> Specification<T> for FnSpec<F>

Source§

impl<T, S: Specification<T>> Specification<T> for NotSpec<S>