Skip to content

Commit 2879e94

Browse files
committed
Rewrite enum representation allocation information
1 parent 6e477e0 commit 2879e94

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

_src/enum-representations.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ In JSON and other self-describing formats, the externally tagged representation
4040
is often not ideal for readability. Serde provides attributes to select three
4141
other possible representations.
4242

43-
**Note**: This is the only enums representation that requires neither `std` nor
44-
`alloc` Cargo features to be enabled.
43+
All enum representations work in no-std projects, but externally tagged is the
44+
only one that works in no-alloc projects.
4545

4646
## Internally tagged
4747

@@ -76,6 +76,9 @@ structs or maps, and unit variants but does not work for enums containing tuple
7676
variants. Using a `#[serde(tag = "...")]` attribute on an enum containing a
7777
tuple variant is an error at compile time.
7878

79+
The `serde` crate's "alloc" Cargo feature must be enabled to deserialize an
80+
internally tagged enum. (It is enabled by default.)
81+
7982
## Adjacently tagged
8083

8184
```rust
@@ -103,6 +106,9 @@ This representation is common in the Haskell world. Written in JSON syntax:
103106
The tag and the content are adjacent to each other as two fields within the same
104107
object.
105108

109+
The `serde` crate's "alloc" Cargo feature must be enabled to deserialize an
110+
adjacently tagged enum. (It is enabled by default.)
111+
106112
## Untagged
107113

108114
```rust
@@ -148,3 +154,6 @@ enum Data {
148154
#
149155
# fn main() {}
150156
```
157+
158+
The `serde` crate's "alloc" Cargo feature must be enabled to deserialize an
159+
untagged tagged enum. (It is enabled by default.)

0 commit comments

Comments
 (0)