| Crates.io | enumly |
| lib.rs | enumly |
| version | 1.1.1 |
| created_at | 2025-12-17 15:51:28.731829+00 |
| updated_at | 2025-12-17 16:02:57.840559+00 |
| description | Provides a procedural macro that exposes a compile-time static list of all variants of an enum. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1990582 |
| size | 6,197 |
Provides a procedural macro that exposes a compile-time static list of all variants of an enum.
use enumly::Enumly;
#[derive(Enumly, Debug, PartialEq)]
enum Color {
Red,
Green,
Blue,
}
assert_eq!(Color::COUNT, 3);
assert_eq!(Color::VARIANTS, &[Color::Red, Color::Green, Color::Blue]);
Non-unit variants are rejected at compile time:
use enumly::Enumly;
#[derive(Enumly)]
enum Bad {
Tuple(u8),
Struct { value: u8 },
}