I would like the first option that is not None. Only when none of the Options has anything, then I want None. Here is some code that accomplishes that:
fn main() {
let result = a().or_else(|| b().or_else(|| c().or_else(|| d())));
dbg!(result);
}
fn a() -> Option<u32> { None }
fn b() -> Option<u32> { None }
fn c() -> Option<u32> { None }
fn d() -> Option<u32> { None }
But this closure-in-closure-in-closure style is difficult to read. Can I rewrite it to have no nested closures?