enum_const_derive

Crates.ioenum_const_derive
lib.rsenum_const_derive
version0.1.1
sourcesrc
created_at2022-05-22 17:41:36.432361
updated_at2022-05-22 17:48:55.098283
descriptionenum const trait
homepage
repositoryhttps://github.com/henrylee2cn/enum_const
max_upload_size
id591357
size4,507
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