description 0.3.0

like Display, but 'static
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use description::Description;

const SOME_CONSTANT: usize = 5;

#[derive(Description)]
enum SomeStatusEnum {
    #[description("the constant is {SOME_CONSTANT}, and the max u32 is {}", u32::MAX)]
    ShowConstant,

    #[description("i'm not showing the constant")]
    DontShowConstant,
}

fn main() {
    let charger = SomeStatusEnum::ShowConstant;

    println!("enum message: {}", charger.description());
}