1 unstable release

Uses old Rust 2015

0.0.0 Feb 1, 2018

#482 in #display

Download history 118/week @ 2024-04-01 54/week @ 2024-04-08 70/week @ 2024-04-15 73/week @ 2024-04-22 86/week @ 2024-04-29 71/week @ 2024-05-06 73/week @ 2024-05-13 67/week @ 2024-05-20 59/week @ 2024-05-27 63/week @ 2024-06-03 45/week @ 2024-06-10 71/week @ 2024-06-17 62/week @ 2024-06-24 34/week @ 2024-07-08 80/week @ 2024-07-15

183 downloads per month
Used in 7 crates (4 directly)

MIT/Apache

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