enum_index_repr

Crates.ioenum_index_repr
lib.rsenum_index_repr
version0.2.1
sourcesrc
created_at2022-11-25 13:34:21.959929
updated_at2022-11-25 13:55:51.697248
descriptionEnumIndexRepr provides a small macro which allows getting the index on an enum.
homepage
repository
max_upload_size
id722779
size1,747
Ramon Brand (ramon54321)

documentation

README

EnumIndex

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

cargo fmt