pub fn why<'a, In, PosOut, NegOut>(
matcher: Matcher<'a, In, PosOut, NegOut>,
reason: impl Into<Cow<'a, str>>
) -> Matcher<'_, In, PosOut, NegOut>where
In: 'a,
PosOut: 'a,
NegOut: 'a,
Expand description
Attaches a context string to a matcher that will appear in the failure output.
Examples
use xpct::{expect, why, be_ge};
let index = 2_i32;
expect!(index).to(why(
be_ge(0),
"indices must be positive"
));