ok_or_continue

Macro ok_or_continue 

Source
macro_rules! ok_or_continue {
    ($from:expr) => { ... };
    ($from:expr, $lt:lifetime) => { ... };
}
Expand description

Either get the value from a Result type or continue in a loop. If a loop lifetime is specified, that loop will be “continued”, otherwise the immediate loop is “continued”.

use early_returns::ok_or_continue;
fn do_something_with_option(vals: &Vec<Result<i32, ()>>) {
    for val in vals {
        let val = ok_or_continue!(val);
        println!("{}", val);
    }

    'l: for val in vals {
        for i in 0..5 {
            let val = ok_or_continue!(val, 'l);
            println!("{}", val + i);
        }
    }
}