In a function body that returns Option<T>, I can use the ? operator either get the Some or early-return None.
fn foo(thing: Thing) -> Option<i32> {
let x = thing.foo()?.bar()?;
...
}
I have some code that defines an event handler function like this one below. The handler closure returns nothing (ie, ()). My typical pattern is to unwrap a few Options.
Yeah, you may have to fiddle with it a bit, if the last call in the chain doesn't return an Option anymore, you have to add a dummy Some(()) as the lambda's return value to make it typecheck.
Would this stabilization include FromResidual? (I know you can't make any promises, but would stabilization of try blocks automatically include stabilization of FromResidual?).
The stabilization of the traits is probably separate from the stabilization of try blocks themselves, like how ? is stable without the traits being stable.