From 3f6d467834bd862de07d1844b5847331cd160f59 Mon Sep 17 00:00:00 2001 From: Everett Pompeii Date: Thu, 27 Oct 2022 14:51:50 -0400 Subject: [PATCH] Untagged enum with unit variant --- enum-representations.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enum-representations.html b/enum-representations.html index 4f8cb986..91f18e1a 100644 --- a/enum-representations.html +++ b/enum-representations.html @@ -717,7 +717,7 @@

There is no explicit tag identifying which variant the data contains. Serde will try to match the data against each variant in order and the first one that deserializes successfully is the one returned.

-

This representation can handle enums containing any type of variant.

+

This representation can handle enums containing any type of variant. However, all unit variants will always serialize as `null`.

As another example of an untagged enum, this enum can be deserialized from either an integer or an array of two strings:

#[derive(Serialize, Deserialize)]