Derive Macro Ordinal

Source
#[derive(Ordinal)]
Expand description

Generates a fn ordinal(&self) -> usize for an enum.

The enum may have any number of variants. It is not required to be a C-like enum, i.e. its variants may have named or unnamed fields.

The returned ordinals will correspond to the variant’s index in the enum definition. For example, the first variant of enum will have ordinal 0.