Which is more idiomatic: Option<Result<T>> or Result<Option<T>>?

I'm having a bit of a deja vu :slight_smile: This might be interesting related reading:

The difference is in the nesting, and thus also which part of the operation the Err applies to.
I tried to write some more examples, but they all end up being basically what Vitaly already wrote...

The difference is indeed quite subtle, and I think there are some cases where Result<Option<>> is better, and other cases where Option<Result<>> is better.

1 Like