Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help improve experience with untagged schemas #156

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions _src/container-attrs.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
Use the untagged enum representation for this enum. See [enum
representations](enum-representations.md) for details on this representation.

When no variant matches, the error may be uninformative which can be improved with [`serde(expecting)`](#expecting).

In performance-critical code, checking each variant and processing the errors can be slow.
In these cases, it may be better to hand-implement the deserialize trait for which [serde-untagged] may help.

- ##### `#[serde(bound = "T: MyTrait")]` {#bound}

Where-clause for the `Serialize` and `Deserialize` impls. This replaces any
Expand Down Expand Up @@ -120,3 +125,5 @@
Specify a custom type expectation text for deserialization error messages.
This is used by the generated `expecting` method for the container `Visitor`,
and as a fallthrough error message for untagged enums.

[serde-untagged]: https://docs.rs/serde-untagged