Re:Announcing Rust 1.13
by steveklabnik on Thursday November 10, 2016 @03:59PM
(#12924292)
They have to be convertible to the type that's being returned. You'd need an implementation of y -> z. It will call the conversion function for you.
With only the above code, we get an error:
So by implementing it...
Now `?` does the coercion automatically.
[ Parent
| on HN ]
Re:Announcing Rust 1.13
by tomtomtom777 on Thursday November 10, 2016 @04:06PM
(#12924339)
This is one of the things that makes Rust's error handling so elegant.
The error "handling" code mostly part of the error types themselves, mostly in the form of to/from conversions.
The actual logic code can then rely on these conversions and is freed from bloat.