4 ms·
> I sort of wish there was some official `Outcome` type defined as an alias of `Result<T, Box<dyn Error>>` Would it be as easy as type OutCome<T> = Result<T,
by lr1970 6y ago
> I sort of wish there was some official `Outcome` type defined as an alias of `Result<T, Box<dyn Error>>`
Would it be as easy as
type OutCome<T> = Result<T, Box<dyn Error>>;
- rectang 6y agoYes! But... 1) If I type that line myself, I want to know what `Box<dyn Error>` means. 2) For an audience of mixed levels of Rust expertise, the `Box<dyn Error>` idiom is on average clearer, because the more experienced Rustaceans will have seen it before while `Outcome` will be unfamiliar and in need of explanation. I thought about publishing a crate with just that one line, but there's already a slew of other similar solutions out there (anyhow, any-error, etc...). There's not that much to gain. I just think it's worth pointing out that it's weird to require newbies to understand `Box` and `dyn` in order to handle errors.