enumkit-derive
This crate provides proc macros for use with enumkit:
#[derive(EnumValues)]– Adds avalues()method that returns all unit enum variants.#[derive(EnumMapping)]– Generates a struct mapping enum variants to values in a static array.
These macros only work with enums composed entirely of unit variants (i.e., variants with no associated data).
Usage
Add to your Cargo.toml:
[]
= "<version>"
Then derive the macros on your enum:
use ;
See enumkit for the trait definitions and runtime behavior.
Notes
- These macros panic at compile time if used on non-unit enums.
- Serialization support via
serdeis opt-in via feature flags inenumkit.
License
MIT or Apache-2.0