enumly

Crates.ioenumly
lib.rsenumly
version1.1.1
created_at2025-12-17 15:51:28.731829+00
updated_at2025-12-17 16:02:57.840559+00
descriptionProvides a procedural macro that exposes a compile-time static list of all variants of an enum.
homepage
repository
max_upload_size
id1990582
size6,197
Jababa (im-jababa)

documentation

README

enumly

Github Crates.io Docs.rs Build

Provides a procedural macro that exposes a compile-time static list of all variants of an enum.

Usage

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]);

What does not work

Non-unit variants are rejected at compile time:

use enumly::Enumly;

#[derive(Enumly)]
enum Bad {
    Tuple(u8),
    Struct { value: u8 },
}
Commit count: 0

cargo fmt