| Crates.io | enumkit-derive |
| lib.rs | enumkit-derive |
| version | 0.0.0 |
| created_at | 2025-07-09 19:44:53.914216+00 |
| updated_at | 2025-07-09 19:44:53.914216+00 |
| description | Derive macros for enumkit. |
| homepage | https://github.com/veggiebob/enumkit |
| repository | https://github.com/veggiebob/enumkit |
| max_upload_size | |
| id | 1745370 |
| size | 10,381 |
This crate provides proc macros for use with enumkit:
#[derive(EnumValues)] – Adds a values() 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).
Add to your Cargo.toml:
[dependencies]
enumkit-derive = "<version>"
Then derive the macros on your enum:
use enumkit::{EnumValues, EnumMapping};
#[derive(EnumValues, EnumMapping)]
enum Mode {
Fast,
Slow,
Sleep,
}
See enumkit for the trait definitions and runtime behavior.
serde is opt-in via feature flags in enumkit.MIT or Apache-2.0