variant-map-derive

Crates.iovariant-map-derive
lib.rsvariant-map-derive
version0.1.0
sourcesrc
created_at2023-09-06 16:54:37.990526
updated_at2023-09-06 16:54:37.990526
descriptionderive macro for the variant-map crate, adds another type called StructMap
homepage
repositoryhttps://github.com/mxyns/variant-map
max_upload_size
id965475
size42,577
Maxou (mxyns)

documentation

README

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

Commit count: 34

cargo fmt