into_variant 0.3.0

Easily convert your types into the corresponding enum variant
Documentation
use into_variant::VariantFrom;

#[derive(VariantFrom)]
enum Fill {
    Color(Color),
    Pattern(Pattern),
}

struct Color {}

struct Pattern {}

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

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