#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

#95 in #rename

Download history 117/week @ 2024-08-04 14/week @ 2024-08-11 55/week @ 2024-08-18 31/week @ 2024-08-25 40/week @ 2024-09-01 24/week @ 2024-09-08 77/week @ 2024-09-15 118/week @ 2024-09-22 49/week @ 2024-09-29 19/week @ 2024-10-06 30/week @ 2024-10-13 43/week @ 2024-10-20 125/week @ 2024-10-27 65/week @ 2024-11-03 113/week @ 2024-11-10

347 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