matched_enums 1.3.0

A macro that provides the option to bin enum attribute to match-statements. This makes it easier to convert values into enums.
Documentation
use rstest::rstest;

use crate::Matched;

#[derive(Matched, PartialEq, Debug)]
enum Foo {
    #[matches(..=1)]
    Bar,

    #[matches(-5..=5, precedence=0)]
    Baz,

    #[matches(6..)]
    Fred,
}

#[rstest]
#[case(0, Foo::Baz)] // Value is both part of [`Foo::Bar`] and [`Foo::Baz`].
#[case(-6, Foo::Bar)]
#[case(10, Foo::Fred)]
pub fn from_value(#[case] input: i32, #[case] expected: Foo) {
    assert_eq!(Foo::from(input), expected);
}