2 releases

0.1.1 May 22, 2022
0.1.0 May 22, 2022

#1982 in #testing

Download history 115/week @ 2024-07-19 7/week @ 2024-07-26 107/week @ 2024-08-02 78/week @ 2024-08-09 137/week @ 2024-08-16 135/week @ 2024-08-23 44/week @ 2024-08-30 8/week @ 2024-09-06 35/week @ 2024-09-13 37/week @ 2024-09-20 101/week @ 2024-09-27 59/week @ 2024-10-04 9/week @ 2024-10-11 63/week @ 2024-10-18 130/week @ 2024-10-25 231/week @ 2024-11-01

438 downloads per month
Used in enum_const

Apache-2.0

5KB
53 lines

enum_const

enum const trait

usage

use enum_const::EnumConst;

#[derive(EnumConst, PartialEq, Debug)]
enum Foo {
    X = 1,
    Y = 2,
    Z,
}

#[test]
fn it_works() {
    assert_eq!(Some(Foo::X), Foo::from_const_isize(1));
    assert_eq!(Some(1isize), Foo::X.get_const_isize());
}

Dependencies

~1.5MB
~37K SLoC