This might be the same question as:
just 4 years later.
Again and again in my code I hit a necessity to handle "something that can either get cancelled, error-out, or return a value". Once I have a need to deal with it it becomes rather vast in scope. Eg. I have a large program that needs to handle shutdown event in many parts of its code that are semi-blocking (in logical sense) and need to be able to exit prematurely without returning Err
.
I do know .transpose()
is here, but it's just a small scale bandaid.
Are there any better options nowadays? Crates? Would rfcs/3058-try-trait-v2.md at master · rust-lang/rfcs · GitHub potentially help?
I guess what I'd like is for ?
and From
to work smoothly between all variations of a fallible and non-fallible operations etc.
Would it make sense to haved enum CancelableResult { ... }
and impl all the interoperability with Option
and Result
and their nested variants?
Pinging @matklad , since you were seeking answer for it before, so you might have some insight on it today.