Skip to content

Commit 9f0974c

Browse files
author
Everett Pompeii
committed
Untagged enum with unit variant
1 parent 7d1c3d6 commit 9f0974c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

enum-representations.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ <h2 id="untagged"><a name="untagged" class="plugin-anchor" href="#untagged"><i c
717717
<p>There is no explicit tag identifying which variant the data contains. Serde will
718718
try to match the data against each variant in order and the first one that
719719
deserializes successfully is the one returned.</p>
720-
<p>This representation can handle enums containing any type of variant.</p>
720+
<p>This representation can handle enums containing any type of variant. However, all unit variants will always serialize as `null`.</p>
721721
<p>As another example of an untagged enum, this enum can be deserialized from
722722
either an integer or an array of two strings:</p>
723723
<pre><code class="lang-rust"><span class="hljs-meta">#[derive(Serialize, Deserialize)]</span>

0 commit comments

Comments
 (0)