Skip to main content

MatcherBase

Trait MatcherBase 

Source
pub trait MatcherBase {
    // Provided methods
    fn and<Right>(self, right: Right) -> ConjunctionMatcher<Self, Right>
       where Self: Sized { ... }
    fn or<Right>(self, right: Right) -> DisjunctionMatcher<Self, Right>
       where Self: Sized { ... }
}
Expand description

Base trait for matchers. Any type implementing Matcher must implement MatcherBase, but that should be done through the #[derive(MatcherBase)] macro.

Provided Methods§

Source

fn and<Right>(self, right: Right) -> ConjunctionMatcher<Self, Right>
where Self: Sized,

Constructs a matcher that matches both self and right.

verify_that!("A string", starts_with("A").and(ends_with("string")))?; // Passes
verify_that!("A string", starts_with("Another").and(ends_with("string")))?; // Fails
verify_that!("A string", starts_with("A").and(ends_with("non-string")))?; // Fails
Source

fn or<Right>(self, right: Right) -> DisjunctionMatcher<Self, Right>
where Self: Sized,

Constructs a matcher that matches when at least one of self or right matches the input.

verify_that!(10, eq(2).or(ge(5)))?;  // Passes
verify_that!(10, eq(2).or(eq(5)).or(ge(9)))?;  // Passes
verify_that!(10, eq(2).or(ge(15)))?; // Fails

Implementations on Foreign Types§

Source§

impl MatcherBase for ()

Source§

impl<I0: MatcherBase> MatcherBase for (I0,)

Source§

impl<I0: MatcherBase, I1: MatcherBase> MatcherBase for (I0, I1)

Source§

impl<I0: MatcherBase, I1: MatcherBase, I2: MatcherBase> MatcherBase for (I0, I1, I2)

Source§

impl<I0: MatcherBase, I1: MatcherBase, I2: MatcherBase, I3: MatcherBase> MatcherBase for (I0, I1, I2, I3)

Source§

impl<I0: MatcherBase, I1: MatcherBase, I2: MatcherBase, I3: MatcherBase, I4: MatcherBase> MatcherBase for (I0, I1, I2, I3, I4)

Source§

impl<I0: MatcherBase, I1: MatcherBase, I2: MatcherBase, I3: MatcherBase, I4: MatcherBase, I5: MatcherBase> MatcherBase for (I0, I1, I2, I3, I4, I5)

Source§

impl<I0: MatcherBase, I1: MatcherBase, I2: MatcherBase, I3: MatcherBase, I4: MatcherBase, I5: MatcherBase, I6: MatcherBase> MatcherBase for (I0, I1, I2, I3, I4, I5, I6)

Source§

impl<I0: MatcherBase, I1: MatcherBase, I2: MatcherBase, I3: MatcherBase, I4: MatcherBase, I5: MatcherBase, I6: MatcherBase, I7: MatcherBase> MatcherBase for (I0, I1, I2, I3, I4, I5, I6, I7)

Source§

impl<I0: MatcherBase, I1: MatcherBase, I2: MatcherBase, I3: MatcherBase, I4: MatcherBase, I5: MatcherBase, I6: MatcherBase, I7: MatcherBase, I8: MatcherBase> MatcherBase for (I0, I1, I2, I3, I4, I5, I6, I7, I8)

Source§

impl<I0: MatcherBase, I1: MatcherBase, I2: MatcherBase, I3: MatcherBase, I4: MatcherBase, I5: MatcherBase, I6: MatcherBase, I7: MatcherBase, I8: MatcherBase, I9: MatcherBase> MatcherBase for (I0, I1, I2, I3, I4, I5, I6, I7, I8, I9)

Source§

impl<I0: MatcherBase, I1: MatcherBase, I2: MatcherBase, I3: MatcherBase, I4: MatcherBase, I5: MatcherBase, I6: MatcherBase, I7: MatcherBase, I8: MatcherBase, I9: MatcherBase, I10: MatcherBase> MatcherBase for (I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10)

Source§

impl<I0: MatcherBase, I1: MatcherBase, I2: MatcherBase, I3: MatcherBase, I4: MatcherBase, I5: MatcherBase, I6: MatcherBase, I7: MatcherBase, I8: MatcherBase, I9: MatcherBase, I10: MatcherBase, I11: MatcherBase> MatcherBase for (I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11)

Source§

impl<M: ?Sized + MatcherBase> MatcherBase for &M

Implementors§

Source§

impl<ExpectedT> MatcherBase for StrMatcher<ExpectedT>

Source§

impl<InnerMatcherT> MatcherBase for ContainsMatcher<InnerMatcherT>

Source§

impl<P, D1, D2> MatcherBase for PredicateMatcher<P, D1, D2>

Source§

impl<T> MatcherBase for EqMatcher<T>

Source§

impl<T: Debug> MatcherBase for NearMatcher<T>