4 releases (stable)
1.0.2 | Oct 1, 2023 |
---|---|
1.0.1 | Sep 18, 2023 |
0.1.0 | May 12, 2023 |
#33 in #let
32 downloads per month
6KB
let_or_return
⚠️ This crate is deprecated. Use the let-else
statement instead.
Convenient Rust macro to extract a value via if let
, and return
in the else case.
lib.rs
:
⚠️ 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.