Macro contrafact::check_fallible[][src]

macro_rules! check_fallible {
    ($blk:block) => { ... };
}
Expand description

Helper macro to run a check which may produce a Result, mapping any Err into a normal Check error string.

use contrafact::*;

// This is most useful when implementing [`Fact::check`]
let check: Check = check_fallible! {{
    Err(anyhow::Error::msg("message"))?;
    Ok(Check::pass())
}};
assert_eq!(check, Check::fail("message"));