enum_ids 0.7.0

Generate a companion ID enum and an associated getter method for the annotated enum
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use enum_ids::enum_ids;

#[enum_ids(display_from_value)]
#[derive(Debug, Clone)]
pub enum Kind {
    A(i32),
    B(String),
    C(f64),
}

fn main() {
    println!("{}", Kind::A(12));
    println!("{}", Kind::B(String::from("test")));
    println!("{}", Kind::C(12.0));
}