1 unstable release
Uses old Rust 2015
0.0.0 | Feb 1, 2018 |
---|
#482 in #display
183 downloads per month
Used in 7 crates
(4 directly)
6KB
87 lines
Derive Display
A derive for the Display
trait.
#[macro_use] extern crate display_derive;
#[derive(Display)]
#[display(fmt = "Error code: {}", code)]
struct RecordError {
code: u32,
}
#[derive(Display)]
enum EnumError {
#[display(fmt = "Error code: {}", code)]
StructVariant {
code: i32,
},
#[display(fmt = "Error: {}", _0)]
TupleVariant(&'static str),
#[display(fmt = "An error has occurred.")]
UnitVariant,
}
Dependencies
~2MB
~42K SLoC