justerror
This macro piggybacks on thiserror crate and is supposed to reduce the amount of handwriting when you want errors in your app to be described via explicit types (rather than anyhow).
Installation
Add to Cargo.toml:
= "0.1"
Add to main.rs:
extern crate justerror;
Usage
This macro takes a subject struct or enum and applies thiserror attributes with predefined #[error] messages.
Generally, you can attach #[Error] macro to an error type and be done with it.
eprintln!;
// EnumError::Bar
// === DEBUG DATA:
// a: Hey!
// b: 42
Macro accepts two optional arguments:
desc: stringfmt:display|debug|"<custom format>"
Both can be applied at the root level.
And at the variant level.
fmt can also be applied to individual fields.
See tests for more examples.
License
MIT.