enum_index_repr 0.2.1

EnumIndexRepr provides a small macro which allows getting the index on an enum.
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 2.65 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ramon54321

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);
}