Crates.io | enum_all_variants |
lib.rs | enum_all_variants |
version | 0.2.0 |
source | src |
created_at | 2023-10-10 18:31:01.829682 |
updated_at | 2024-03-18 06:06:32.414881 |
description | Generate a list of all enum variants in Rust |
homepage | https://github.com/benfaerber/enum_all_variants |
repository | https://github.com/benfaerber/enum_all_variants |
max_upload_size | |
id | 999377 |
size | 4,868 |
Proc macro for generating a list of all enum variants.
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]