enum_const

Crates.ioenum_const
lib.rsenum_const
version0.1.1
sourcesrc
created_at2022-05-22 17:45:34.855449
updated_at2022-05-22 17:51:58.647554
descriptionenum const trait
homepage
repositoryhttps://github.com/henrylee2cn/enum_const
max_upload_size
id591359
size13,377
Andeya (andeya)

documentation

README

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());
}
Commit count: 3

cargo fmt