MatcherExt

Trait MatcherExt 

Source
pub trait MatcherExt<T: Matchable>: Matcher<T> {
    // Provided methods
    fn filter<'a>(&self, values: &'a [T]) -> Vec<&'a T> { ... }
    fn matches_all(&self, values: &[T]) -> Vec<bool> { ... }
}
Expand description

Extension trait providing batch operations.

This trait is blanket implemented for all Matcher types, providing convenient methods for operating on collections of values.

§Example

use condition_matcher::{Matcher, MatcherExt, MatcherBuilder};

let matcher = MatcherBuilder::<i32>::new()
    .value_equals(42)
    .build();

let values = vec![40, 41, 42, 43, 42];
let matches = matcher.filter(&values);
assert_eq!(matches.len(), 2);

Provided Methods§

Source

fn filter<'a>(&self, values: &'a [T]) -> Vec<&'a T>

Filter values, returning references to those that match.

Source

fn matches_all(&self, values: &[T]) -> Vec<bool>

Check all values, returning match results as a vector of booleans.

Implementors§

Source§

impl<T: Matchable, M: Matcher<T>> MatcherExt<T> for M