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;

nodyn! {
    #[derive(Debug, PartialEq)]
    pub enum Custom {
        Number(i32),
        Text(String),
    }
}

fn main() {
    let num: Custom = 42.into();
    let text: Custom = "hello".to_string().into();
    assert_eq!(num, Custom::Number(42));
    assert_eq!(text, Custom::Text("hello".to_string()));
}