Crates.io | enum_const |
lib.rs | enum_const |
version | 0.1.1 |
source | src |
created_at | 2022-05-22 17:45:34.855449 |
updated_at | 2022-05-22 17:51:58.647554 |
description | enum const trait |
homepage | |
repository | https://github.com/henrylee2cn/enum_const |
max_upload_size | |
id | 591359 |
size | 13,377 |
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());
}