galvanic_assert::matchers::variant

Function maybe_err

Source
pub fn maybe_err<'a, T: 'a, E: 'a>(
    matcher: Box<dyn Matcher<'a, E> + 'a>,
) -> Box<dyn Matcher<'a, Result<T, E>> + 'a>
Expand description

Matches the contents of a Result if it is Err againts a passed Matcher.

#Examples

use galvanic_assert::matchers::*;
use galvanic_assert::matchers::variant::*;
let err: Result<i32,i32> = Err(32);
assert_that!(&err, maybe_err(eq(32)));