Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The result type is the return from Foo -- Bar::Fail does not need to wrap Result. Foo is Result<T, E> and map_err() would convert it to Result<T, Bar::Fail>. I think GP's `map_err()?` is the most straightforward way of writing this idea (and it's generally speaking how I would suggest writing Rust code).


GP's code will return Result<_, Bar>, the original code we are trying to fix just returns Bar.


If you are writing code to handle Results, it’s going to be a lot less painful to just return Result.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: