Crates.io | variant-map-derive |
lib.rs | variant-map-derive |
version | 0.1.0 |
source | src |
created_at | 2023-09-06 16:54:37.990526 |
updated_at | 2023-09-06 16:54:37.990526 |
description | derive macro for the variant-map crate, adds another type called StructMap |
homepage | |
repository | https://github.com/mxyns/variant-map |
max_upload_size | |
id | 965475 |
size | 42,577 |
Enum variants stored in Maps.
Provides derive macros for variant_map
Includes a StructMap
which is a struct with a field per variant of the enum
Pro: This struct has instant access to the fields (compared to the other Maps that need a lookup)
Con: Restricted API
use variant_map_derive::VariantStore;
#[derive(VariantStore)]
enum MyEnum {
A,
B(i32),
}
For more detailed examples check out the example project on this crates' repo