#helper #enums #macro #variant #rename #serde

macro enum-helper-macros

Helper macros for working with enums

1 unstable release

0.0.1 Aug 5, 2024

#87 in #rename

Download history 113/week @ 2024-08-03 18/week @ 2024-08-10 53/week @ 2024-08-17 28/week @ 2024-08-24 43/week @ 2024-08-31 22/week @ 2024-09-07 77/week @ 2024-09-14 99/week @ 2024-09-21 67/week @ 2024-09-28 22/week @ 2024-10-05 31/week @ 2024-10-12 34/week @ 2024-10-19

169 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
~37K SLoC