3 ms·
> If you are writing your own library then your best bet is to define your own Error enum in each module This is exactly the path that my SNAFU library takes.
by shepmaster 5y ago
> If you are writing your own library then your best bet is to define your own Error enum in each module
This is exactly the path that my SNAFU library takes. It’s a procedural macro attached to an enum that generates the From, Display and Error traits for you.
This way, consumers of your code don’t need to know anything beyond the fact that you implement Error and any inherent public methods or traits you choose to expose. The implementation provided by SNAFU is internal to your code.
https://docs.rs/snafu/0.6.10/snafu/ https://docs.rs/snafu/0.6.10/snafu/