Skip to main content

Matcher

Trait Matcher 

Source
pub trait Matcher<'a, T: 'a> {
    // Required method
    fn check(&self, actual: &'a T) -> MatchResult;
}
Expand description

The trait which has to be implemented by all matchers.

Required Methods§

Source

fn check(&self, actual: &'a T) -> MatchResult

Checks the passed value if it satisfies the Matcher.

Values are always taken as immutable reference as the actual value shouldn’t be changed by the matcher.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, K, V, M> Matcher<'a, M> for HasEntry<K, V>
where V: PartialEq + Debug + 'a, K: PartialEq + Debug + 'a, &'a M: IntoIterator<Item = (&'a K, &'a V)> + 'a,

Source§

impl<'a, K, V, M> Matcher<'a, M> for HasKey<K>
where V: PartialEq + Debug + 'a, K: PartialEq + Debug + 'a, &'a M: IntoIterator<Item = (&'a K, &'a V)> + 'a,

Source§

impl<'a, K, V, M> Matcher<'a, M> for HasValue<V>
where V: PartialEq + Debug + 'a, K: PartialEq + Debug + 'a, &'a M: IntoIterator<Item = (&'a K, &'a V)> + 'a,

Source§

impl<'a, T, I: 'a> Matcher<'a, I> for ContainsInOrder<T>
where T: PartialEq + Debug + 'a, &'a I: IntoIterator<Item = &'a T> + Debug + 'a,

Source§

impl<'a, T, I: 'a> Matcher<'a, I> for ContainsSubset<T>
where T: PartialEq + Debug + 'a, &'a I: IntoIterator<Item = &'a T> + Debug + 'a,

Source§

impl<'a, T, I> Matcher<'a, I> for ContainsInAnyOrder<T>
where T: PartialEq + Debug + 'a, &'a I: IntoIterator<Item = &'a T> + Debug + 'a,

Source§

impl<'a, T: 'a, F> Matcher<'a, T> for F
where F: Fn(&'a T) -> MatchResult + ?Sized,

A closure can be used as a Matcher.

The closure must be repeatably callable in case that the matcher is combined with another matcher.

Source§

impl<'a, T: 'a> Matcher<'a, T> for All<'a, T>

Source§

impl<'a, T: 'a> Matcher<'a, T> for Any<'a, T>

Source§

impl<'a, T> Matcher<'a, T> for ContainedIn<T>
where T: PartialEq + Debug + 'a,