Derive Macro Error
#[derive(Error)]
{
    // Attributes available to this derive:
    #[display]
    #[error]
}
Expand description
Derive macro that implements StackError, Display, Debug, std::error::Error,
and generates From<T> impls for fields/variants configured via #[error(..)].
Recognized attributes:
- on enums:
- #[error(from_sources)]: Creates- Fromimpls for the- sourcetypes of all variants. Will fail to compile if multiple sources have the same type.
- #[error(std_sources)]: Defaults all sources to be std errors instead of stack errors.
 
- on enum variants and structs:
- #[display("..")]: Sets the display formatting. You can refer to named fields by their names, and to tuple fields by- _0,- _1etc.
- #[error(transparent)]: Directly forwards the display implementation to the error source, and omits the outer error in the source chain when reporting errors.
 
- on fields:
- #[error(source)]: Sets a field as the source of this error. If a field is named- sourcethis is applied implicitly and not needed.
- #[error(from)]: Creates a- Fromimpl for the field’s type to the error type.
- #[error(std_err)]: Marks the error as a- stderror. Without this attribute, errors are expected to implement- StackError. Only applicable to source fields.