pub trait MatcherExt: Sized {
// Provided methods
fn and<Right>(self, right: Right) -> ConjunctionMatcher<Self, Right> { ... }
fn or<Right>(self, right: Right) -> DisjunctionMatcher<Self, Right> { ... }
}Expand description
Provided Methods§
Sourcefn and<Right>(self, right: Right) -> ConjunctionMatcher<Self, Right>
fn and<Right>(self, right: Right) -> ConjunctionMatcher<Self, Right>
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")))?; // FailsSourcefn or<Right>(self, right: Right) -> DisjunctionMatcher<Self, Right>
fn or<Right>(self, right: Right) -> DisjunctionMatcher<Self, Right>
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)))?; // FailsDyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".