into_variant 0.3.0

Easily convert your types into the corresponding enum variant
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use into_variant::VariantFrom;

#[derive(VariantFrom)]
#[allow(dead_code)]
enum Fill {
    Color(Color),
    #[into_variant(skip)]
    Gradient((Color, Color)),
}

struct Color {}

#[test]
fn test_from_color() {
    assert!(matches!(Fill::variant_from(Color {}), Fill::Color(_)))
}