Re:Tor in a safer language: Network team update from Amsterdam
by vertex-four on Sunday April 02, 2017 @03:56AM
(#14016353)
Sure, in some cases you want to wrap the error type - Rust handles this by essentially having you create a custom error type which is an enum (which can be done via macros like quick-error and error-chain), and implementing From<BarError> on it which'd create your custom error type from the BarError. This trait is used by both the try!() macro and the ? operator (which do much the same thing, the latter being the updated syntax):
If you need to do something custom in converting bar()'s error into your error type - which is rare - you can use .map_err() like this:
[ Parent
| on HN ]
There are no comments on this comment yet.