Macro nutype_enum

Source
macro_rules! nutype_enum {
    (
        $(#[$attr:meta])*
        $vis:vis enum $name:ident($type:ty) {
            $(
                $(#[$variant_attr:meta])*
                $variant:ident = $value:expr
            ),*$(,)?
        }
    ) => { ... };
}
Expand description

Helper macro to create a new enum type with a single field.

The enum type is derived with the Clone, Copy, PartialEq, Eq, PartialOrd, Ord, and Hash traits. The nutype also impls From and Into for the underlying type. As well as a custom Debug impl for human readable output.

ยงExamples

nutype_enum! {
    pub enum AacPacketType(u8) {
        SeqHdr = 0x0,
        Raw = 0x1,
    }
}