macro_rules! unwrap_opt_block {
    ($body:block $($arg:tt)*) => { ... };
}
Expand description

Unwraps a block which returns an Option.

This is useful for running checked math expressions within a function which returns Result.

Examples

let result = unwrap_opt_block!({
    let one: u64 = 1;
    let three: u64 = 3;
    let four = one.checked_add(three)?;
    four.checked_add(3)
});
assert_eq!(result, 7);