Crates.io | enum_const_derive |
lib.rs | enum_const_derive |
version | 0.1.1 |
source | src |
created_at | 2022-05-22 17:41:36.432361 |
updated_at | 2022-05-22 17:48:55.098283 |
description | enum const trait |
homepage | |
repository | https://github.com/henrylee2cn/enum_const |
max_upload_size | |
id | 591357 |
size | 4,507 |
enum const trait
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());
}