Rust Clean Way d'obtenir l'option :: comportement uncomplacé_or_else avec une option <

fn use_or_default_nicer(thing_ref_opt: Option<&ExpensiveUnclonableThing>) {
    let mut maybe = None;
    let thing_ref = thing_ref_opt.unwrap_or_else(
        || maybe.insert(make_the_thing())
    );
    use_the_thing(thing_ref);
}
SAMER SAEID