nodyn 0.2.2

Easy polymorphism with enums
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use nodyn::nodyn;
use std::convert::TryFrom;

nodyn! {
    pub enum Foo {
        i64,
        #[into(i64)]
        i32,
    }
    impl TryInto;
}

fn main() {
    let foo: Foo = 42i32.into();
    assert_eq!(i64::try_from(foo).unwrap(), 42i64);
}