3 ms·
Something worth mentioning is that your error types do NOT have to implement std::error::Error. The type parameters on Result<T, E> have no constraints. So, on
by ragnese 5y ago
Something worth mentioning is that your error types do NOT have to implement std::error::Error. The type parameters on Result<T, E> have no constraints.
So, only your public API should implement std::error::Error.
Likewise, you don't HAVE TO implement From for all of your error types. In fact, it has some of the same concerns that implicit constructors in C++ have in that it's easy to just throw try-operators around without thinking about whether you actually want to bubble up an error in a specific scenario.
I think a lot of people who pick up Rust might not realize that and end up thinking the error defining process is even more tedious than it really is.