1 unstable release

Uses old Rust 2015

0.0.0 Feb 1, 2018

#501 in #display

Download history 64/week @ 2024-07-29 80/week @ 2024-08-05 67/week @ 2024-08-12 49/week @ 2024-08-19 57/week @ 2024-08-26 35/week @ 2024-09-02 37/week @ 2024-09-09 45/week @ 2024-09-16 86/week @ 2024-09-23 82/week @ 2024-09-30 2/week @ 2024-10-07 32/week @ 2024-10-14 24/week @ 2024-10-21 28/week @ 2024-10-28 47/week @ 2024-11-04 5/week @ 2024-11-11

107 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
~43K SLoC