macro_rules! impl_case_insensitive_enum {
($enum_name:ident, { $($variant_str:expr => $variant:ident),* $(,)? }) => { ... };
}
Expand description
Macro to implement case-insensitive deserialization for enums with simple string variants.
This macro generates a custom Deserialize
implementation for an enum that makes
variant string matching case-insensitive. It works with enums that use string
representation in serialization (e.g., with #[serde(tag = "type")]
).
The generated implementation will match variant names case-insensitively, so both
"variant1"
and "VARIANT1"
will be deserialized as MyEnum::Variant1
.