macro_rules! impl_le_for_enum {
    ($ty:ident, $repr:ident) => { ... };
}
Expand description

The macro impl_le_for_enum implements trait LE for enum.

The enum must specify a integer type via repr.

Examples

#[macro_use] extern crate blockbuffers;
use blockbuffers::le::LE;

#[repr(u16)]
#[derive(Copy, Clone)]
enum Side {
  Left = 1,
  Right = 2,
}
impl_le_for_enum!(Side, u16);

assert_eq!(1u16, Side::from_le(Side::Left.to_le()) as u16);
assert_eq!(2u16, Side::from_le(Side::Right.to_le()) as u16);