Skip to content

Commit 0de9c89

Browse files
committed
Add documentation for variant_identifier and field_identifier
1 parent ae9e982 commit 0de9c89

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

_src/container-attrs.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@
5252
Use the untagged enum representation for this enum. See [enum
5353
representations](enum-representations.md) for details on this representation.
5454

55+
- ##### `#[serde(variant_identifier)]` {#variant--identifier}
56+
57+
Use an identifier representation for this enum. This can only be applied to enums that are C-like (containing only unit variants), and forces them to always be represented as strings, regardless of the underlying data format's representation of enums.
58+
59+
- ##### `#[serde(field_identifier)]` {#field--identifier}
60+
61+
Identical to [`variant_identifier`](#variant--identifier), but also allows for the last variant to be a newtype variant, which will be used if none of the other variants match (similar to [`#[serde(other)]`](../variant-attrs.html#other)). Like `variant_identifier`, this forces the enum to always be represented as a string, regardless of the underlying data format's representation of enums.
62+
5563
- ##### `#[serde(bound = "T: MyTrait")]` {#bound}
5664

5765
Where-clause for the `Serialize` and `Deserialize` impls. This replaces any

0 commit comments

Comments
 (0)