rust-primitive_enum
Little utility for dealing with C-style enums
This crate exports just the single macro primitive_enum!
that defines an enum backed by a user specified primitive
integer type.
The intent is to emulate traditional C-style enums while adding some handy associated functions useful in such contexts (e.g. enumerating over each enum and converting between the underlying types).
Example
extern crate primitive_enum;
primitive_enum!
Expansion
As of the current version, the macro
extern crate primitive_enum;
primitive_enum!
is effectively equivalent to
This crate is a clean macro implementation that expands to code shown above and doesn't rely on any outside dependencies or magic.