[][src]Macro gba_hal::newtype_enum

macro_rules! newtype_enum {
    (
    $(#[$struct_attr:meta])*
    $new_name:ident = $old_name:ident,
    $($(#[$tag_attr:meta])* $tag_name:ident = $base_value:expr,)*
  ) => { ... };
}

Assists in defining a newtype that's an enum.

First give NewType = OldType,, then define the tags and their explicit values with zero or more entries of TagName = base_value,. In both cases you can place doc comments or other attributes directly on to the type declaration or the tag declaration.

The generated enum will get an appropriate repr attribute as well as Debug, Clone, Copy, PartialEq, and Eq

newtype_enum! {
  /// The Foo
  Foo = u16,
  /// The Bar
  Bar = 0,
  /// The Zap
  Zap = 1,
}