Macro vipers::try_or_err[][src]

macro_rules! try_or_err {
    ($result : expr, $error : tt $(,) ?) => { ... };
}
Expand description

Tries to unwrap the Result, otherwise returns the error

Example

fn function_returning_result() -> Result<u64, u64> {
    Err(123)
}

let my_value = try_or_err!(function_returning_result(), MyError);