4 ms·
> Support for Result<Value, Error1 | Error2 | Error3> would be helpful. Or may be support for easily converting one type of error to another. It sounds like yo
by bvinc 10y ago
> Support for Result<Value, Error1 | Error2 | Error3> would be helpful. Or may be support for easily converting one type of error to another.
It sounds like you want to create a new error type that's an enum of Error1, Error2, Error3 and then just implement the From traits. Then you can use ? with no boilerplate error handling.
I'm sure you've already considered this though. Why wouldn't that work for you?
- progval 10y agoDeclaring the new enum and implementing it are the boilerplate.
- ww520 10y agoLots of typing and mental overload. Since we are talking about ergonomics and reducing friction, it would be good to make Result handling easier.
- JelteF 10y agoThe From trait can be derived using my derive_more crate. That would at least decrease the boilerplate a bit. http://jeltef.github.io/derive_more/derive_more/ http://jeltef.github.io/derive_more/derive_more/