From 0de9c8972804143a2295c8cfdc6da341d03f4338 Mon Sep 17 00:00:00 2001 From: Nathan West Date: Tue, 21 Mar 2023 23:24:28 -0400 Subject: [PATCH] Add documentation for `variant_identifier` and `field_identifier` --- _src/container-attrs.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/_src/container-attrs.md b/_src/container-attrs.md index 4fa0e52..c0ff385 100644 --- a/_src/container-attrs.md +++ b/_src/container-attrs.md @@ -52,6 +52,14 @@ Use the untagged enum representation for this enum. See [enum representations](enum-representations.md) for details on this representation. +- ##### `#[serde(variant_identifier)]` {#variant--identifier} + + 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. + +- ##### `#[serde(field_identifier)]` {#field--identifier} + + 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. + - ##### `#[serde(bound = "T: MyTrait")]` {#bound} Where-clause for the `Serialize` and `Deserialize` impls. This replaces any