Skip to content

Commit 759a5f1

Browse files
authored
Merge pull request #158 from ahl/untagged-variant
document enum variant #[serde(untagged)]
2 parents abdfaec + fa68843 commit 759a5f1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

_src/variant-attrs.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,11 @@
9898
containing variants `A`, `B`, and `Unknown` marked `serde(other)`, the
9999
`Unknown` variant would be deserialized any time the `"variant"` field of the
100100
input is neither `"A"` nor `"B"`.
101+
102+
- ##### `#[serde(untagged)]` {#untagged}
103+
104+
Irrespective of the [enum representation](enum-representations.md), serialize
105+
and deserialize this variant as untagged, i.e. simply as the variant's data
106+
with no record of the variant name.
107+
108+
Untagged variants must be ordered last in the enum definition.

0 commit comments

Comments
 (0)