Skip to main content

DecidablePred

Trait DecidablePred 

Source
pub trait DecidablePred<A> {
    // Required method
    fn decide_pred(&self, a: &A) -> Decision<()>;

    // Provided methods
    fn filter_slice<'a>(&self, xs: &'a [A]) -> Vec<&'a A> { ... }
    fn any_slice(&self, xs: &[A]) -> bool { ... }
    fn all_slice(&self, xs: &[A]) -> bool { ... }
    fn count_slice(&self, xs: &[A]) -> usize { ... }
}
Expand description

A decidable predicate P : A → Prop.

Given any a : A, can compute whether P(a) holds.

Required Methods§

Source

fn decide_pred(&self, a: &A) -> Decision<()>

Decide whether the predicate holds for a.

Provided Methods§

Source

fn filter_slice<'a>(&self, xs: &'a [A]) -> Vec<&'a A>

Filter a slice, keeping elements satisfying the predicate.

Source

fn any_slice(&self, xs: &[A]) -> bool

Check whether any element of a slice satisfies the predicate.

Source

fn all_slice(&self, xs: &[A]) -> bool

Check whether all elements of a slice satisfy the predicate.

Source

fn count_slice(&self, xs: &[A]) -> usize

Count elements of a slice satisfying the predicate.

Implementors§

Source§

impl<A, F: Fn(&A) -> bool> DecidablePred<A> for FnPred<A, F>