macro_rules! unwrap_or_err { ($option:expr, $error:ident $(,)?) => { ... }; }
Ensures an Option can be unwrapped, otherwise returns the error.
let one = 1_u64; let two = 2_u64; let my_value = unwrap_or_err!(one.checked_sub(2), MyError); // throws an error Ok(())