galvanic_assert::matchers::variant

Function maybe_ok

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

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

#Examples

use galvanic_assert::matchers::*;
use galvanic_assert::matchers::variant::*;
let ok: Result<i32,()> = Ok(32);
assert_that!(&ok, maybe_ok(eq(32)));