Crate let_or_return

source ·
Expand description

⚠️ This crate is deprecated. Use the let-else statement instead.

The let-else statement is exactly doing what I intended to do with let_or_return macro:

fn process_x(opt_x: &Option<u32>) -> bool {
    let Some(x) = opt_x else { return false };
    // use x
    true
}

Original documentation

Convenient macro to extract a value via if let, and return in the else case.

Macros

  • Extract a value via if let, and return in the else case.