Skip to content

Add a custom serializer for untagged enum unit variants#4

Merged
estk merged 1 commit intoimperva:mainfrom
epompeii:untagged_unit
Oct 27, 2022
Merged

Add a custom serializer for untagged enum unit variants#4
estk merged 1 commit intoimperva:mainfrom
epompeii:untagged_unit

Conversation

@epompeii
Copy link
Copy Markdown
Contributor

@epompeii epompeii commented Oct 27, 2022

Untagged enum unit variants always serialize as null: serde-rs/serde#1560

Therefore, a custom serializer must be implemented in order to create the desired behavior, which is to output the actual unit variant values/names.

An additional PR has been opened to mention this in the serde documentation: serde-rs/serde-rs.github.io#142

@gadunga
Copy link
Copy Markdown
Contributor

gadunga commented Oct 27, 2022

Seems reasonable given the parent issue.

@estk estk merged commit 9366d57 into imperva:main Oct 27, 2022
@epompeii epompeii deleted the untagged_unit branch December 7, 2023 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants