Crates.io | enum_index_repr |
lib.rs | enum_index_repr |
version | 0.2.1 |
source | src |
created_at | 2022-11-25 13:34:21.959929 |
updated_at | 2022-11-25 13:55:51.697248 |
description | EnumIndexRepr provides a small macro which allows getting the index on an enum. |
homepage | |
repository | |
max_upload_size | |
id | 722779 |
size | 1,747 |
EnumIndex provides a small macro which implements EnumIndexGet, permitting the following:
use enum_index_repr::{EnumIndex, EnumIndexGet};
#[repr(u16)]
#[derive(EnumIndex)]
enum Tag {
Hello,
World,
How,
Are,
You,
}
fn main() {
assert_eq!(Tag::How.index(), 2);
}