num_enum 0.5.7

Procedural macros to make inter-operation between primitives and enums easier.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
    Zero = 0,
    #[num_enum(alternatives = [2])]
    One = 1,
    Two = 2,
}

fn main() {

}