Macro vipers::unwrap_opt[][src]

macro_rules! unwrap_opt {
    ($option : expr, $err : expr $(,) ?) => { ... };
}
Expand description

Attempts to unwrap an Option, and if it fails, prints an error.

Example

let one = 1_u64;
let two = 2_u64;
let my_value = unwrap_opt!(one.checked_sub(2), "cannot do this"); // returns an error