enum_convert 0.2.0

A Rust procedural macro library for deriving automatic conversions between enum variants
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use enum_convert::EnumInto;

#[derive(EnumInto)]
#[enum_into(Target)]
enum Source {
    #[enum_into(Target::Stuff)]
    Data {
        #[enum_into(Target::Stuff.nonexistent)] // Invalid field name
        x: i32,
    },
}

enum Target {
    Stuff { x: i64 },
}

fn main() {}