|
70 | 70 | Use the untagged enum representation for this enum. See [enum representations]
|
71 | 71 | for details on this representation.
|
72 | 72 |
|
73 |
| -- ##### `#[serde(variant_identifier)]` {#variant_identifier} |
74 |
| - |
75 |
| - Use an identifier representation for this enum. This can only be applied to |
76 |
| - enums that are C-like (containing only unit variants), and forces them to |
77 |
| - always be represented as strings, regardless of the underlying data format's |
78 |
| - representation of enums. |
79 |
| - |
80 |
| -- ##### `#[serde(field_identifier)]` {#field_identifier} |
81 |
| - |
82 |
| - Identical to [`variant_identifier`], but also allows for the last variant to |
83 |
| - be a newtype variant, which will be used if none of the other variants match |
84 |
| - (similar to [`#[serde(other)]`]). Like `variant_identifier`, this forces the |
85 |
| - enum to always be represented as a string, regardless of the underlying data |
86 |
| - format's representation of enums. |
87 |
| - |
88 |
| - [`variant_identifier`]: #variant_identifier |
89 |
| - [`#[serde(other)`]: variant-attrs.md#other |
90 |
| - |
91 | 73 | - ##### `#[serde(bound = "T: MyTrait")]` {#bound}
|
92 | 74 |
|
93 | 75 | Where-clause for the `Serialize` and `Deserialize` impls. This replaces any
|
|
153 | 135 | Specify a custom type expectation text for deserialization error messages.
|
154 | 136 | This is used by the generated `expecting` method for the container `Visitor`,
|
155 | 137 | and as a fallthrough error message for untagged enums.
|
| 138 | + |
| 139 | +- ##### `#[serde(variant_identifier)]` {#variant_identifier} |
| 140 | + |
| 141 | + Use an identifier representation for this enum. This can only be applied to |
| 142 | + enums that are C-like (containing only unit variants), and forces them to |
| 143 | + always be represented as strings, regardless of the underlying data format's |
| 144 | + representation of enums. |
| 145 | + |
| 146 | +- ##### `#[serde(field_identifier)]` {#field_identifier} |
| 147 | + |
| 148 | + Identical to [`variant_identifier`], but also allows for the last variant to |
| 149 | + be a newtype variant, which will be used if none of the other variants match |
| 150 | + (similar to [`#[serde(other)]`]). Like `variant_identifier`, this forces the |
| 151 | + enum to always be represented as a string, regardless of the underlying data |
| 152 | + format's representation of enums. |
| 153 | + |
| 154 | + [`variant_identifier`]: #variant_identifier |
| 155 | + [`#[serde(other)`]: variant-attrs.md#other |
0 commit comments