1 unstable release
0.1.0 | Sep 6, 2023 |
---|
#82 in #enum
Used in variant-map
43KB
828 lines
variant-map-derive
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
Example
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
lib.rs
:
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
Example
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
Dependencies
~0.7–1.3MB
~29K SLoC