Skip to content

Commit

Permalink
document enum variant #[serde(untagged)]
Browse files Browse the repository at this point in the history
  • Loading branch information
ahl committed Sep 6, 2023
1 parent ce2f4ea commit fa68843
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 fa68843

Please sign in to comment.