#[serde_enum_string]Expand description
Allows a C-style enum to be serialized as a string, useful for human-readable
JSON.
Takes two optional attributes:
-
transform = "<type>"- transform theenumvariants by name into the same formats as supported by the serde attributerename_all. This includes:lowercase- makes variant names lowercaseUPPERCASE- makes variant names UPPERCASEPascalCase- makes variant names PascalCasecamelCase- makes variant names camelCasesnake_case- makes variant names snake_caseSCREAMING_SNAKE_CASE- makes variant names SCREAMING_SNAKE_CASEkebab-case- makes variant names kebab-caseSCREAMING-KEBAB-CASE- makes variant names SCREAMING-KEBAB-CASE
If unspecified, the
enumvariant names will be passed through unmodified. -
prepend_enum_name- Add the name of theenumto the values for each variant. This will be prepended to the variant name before running the transform described above.
Note that this macro is incompatible with existing Serialize and Deserialize impls.
If a Serialize or Deserialize derive is detected, this macro will panic, but if you impl them
directly you will just get normal compiler issues which you’re on your own to figure out.