enum_all_variants

Crates.ioenum_all_variants
lib.rsenum_all_variants
version0.2.0
sourcesrc
created_at2023-10-10 18:31:01.829682
updated_at2024-03-18 06:06:32.414881
descriptionGenerate a list of all enum variants in Rust
homepagehttps://github.com/benfaerber/enum_all_variants
repositoryhttps://github.com/benfaerber/enum_all_variants
max_upload_size
id999377
size4,868
Ben Faerber (benfaerber)

documentation

README

enum_all_variants

Proc macro for generating a list of all enum variants.

Example

use enum_all_variants::AllVariants;

#[derive(AllVariants, Debug)]
enum Direction {
    Left,
    Top,
    Right,
    Bottom,
}

fn main() {
    println!("{:?}", Direction::all_variants());
}

Outputs:

[Left, Top, Right, Bottom]
Commit count: 15

cargo fmt