Skip to content

Commit 12bb7d4

Browse files
committed
Document expecting container attribute
This attribute has flew under the radar of serde documentation since it was introduced by serde-rs/serde#1916. Given how useful it can be to improve untagged enum deserialization error messages and that its introduction has been uncontroversial so far, I think it's a good idea to document it.
1 parent b33520f commit 12bb7d4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

_src/container-attrs.md

+6
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,9 @@
114114
Specify a path to the `serde` crate instance to use when referring to Serde
115115
APIs from generated code. This is normally only applicable when invoking
116116
re-exported Serde derives from a public macro in a different crate.
117+
118+
- ##### `#[serde(expecting = "...")]` {#expecting}
119+
120+
Specify a custom type expectation text for deserialization error messages.
121+
This is used by the generated `expecting` method for the container `Visitor`,
122+
and as a fallthrough error message for untagged enums.

0 commit comments

Comments
 (0)