#enums #enum-variant #enum-helper-macros

macro enum-helper-macros

Helper macros for working with enums

1 unstable release

0.0.1 Aug 5, 2024

#9 in #enums-variant

Download history 59/week @ 2024-11-30 74/week @ 2024-12-07 23/week @ 2024-12-14 9/week @ 2024-12-21 18/week @ 2024-12-28 42/week @ 2025-01-04 71/week @ 2025-01-11 98/week @ 2025-01-18 125/week @ 2025-01-25 61/week @ 2025-02-01 74/week @ 2025-02-08 72/week @ 2025-02-15 148/week @ 2025-02-22 193/week @ 2025-03-01 79/week @ 2025-03-08 114/week @ 2025-03-15

539 downloads per month
Used in 2 crates (via starknet-devnet-server)

Custom license

8KB
131 lines

Helper derive macros for enums

  • AllVariantsSerdeRenames: creates a method fn all_variants_serde_renames() -> Vec<String>, returning all variants serde rename attributes data.
  • VariantName: crates a method fn variant_name(&self) -> &str, returning the serde rename attribute data.

NOTE!

Both macros work only if there is #[serde(rename=...)] attribute applied to all of the enum variants

Dependencies

~1.5MB
~38K SLoC