macro_rules! fail {
($ctx:expr) => { ... };
}
Utility macro to return errors.
#[derive(ErrorContext, PartialEq)]
#[evitable(description = "Error")]
pub struct Context(u8);
fn do_fail(val: u8) -> Result<()> {
fail!(Context(val));
Ok(())
}
assert_eq!(do_fail(15).unwrap_err().context(), &Context(15));