Skip to content

Commit

Permalink
Merge pull request #158 from ahl/untagged-variant
Browse files Browse the repository at this point in the history
document enum variant #[serde(untagged)]
  • Loading branch information
dtolnay authored Oct 13, 2023
2 parents abdfaec + fa68843 commit 759a5f1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions _src/variant-attrs.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,11 @@
containing variants `A`, `B`, and `Unknown` marked `serde(other)`, the
`Unknown` variant would be deserialized any time the `"variant"` field of the
input is neither `"A"` nor `"B"`.

- ##### `#[serde(untagged)]` {#untagged}

Irrespective of the [enum representation](enum-representations.md), serialize
and deserialize this variant as untagged, i.e. simply as the variant's data
with no record of the variant name.

Untagged variants must be ordered last in the enum definition.

0 comments on commit 759a5f1

Please sign in to comment.