err-derive
A failure-like derive macro for the std Error
.
The source code mostly copied from failure-derive
.
Features
- Derive
Display
implementation - Derive
Error
implementation (implementingsource
to return the cause of the error)
Usage
Cargo.toml:
[]
= "0.1"
Rust code:
extern crate err_derive;
use io;
/// `MyError::source` will return a reference to the io_error field
/// `MyEnumError::source` will return a reference only if it is `Variant2`,
/// otherwise it will return `None`.
License
This project is dual-licensed under Apache-2.0 / MIT. You're free to choose one of both licenses. Every contribution made to this project is assumed to be licensed according to these terms.
See LICENSE, LICENSE-MIT and LICENSE-APACHE for more information.