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

RFC: Support deserializing enum values in internally/untagged enums #2692

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Feb 8, 2024

  1. Support deserializing enum values in internally/untagged enums

    Specifically, this deserializes the "variant" as a `Content` and visits
    the value with `newtype_variant::<Content>`.
    
    There is no perfect solution here as the enum value could be a map,
    tuple, unit, etc. However, given that we're trying to deserialize
    arbitrary values, deserializing as a "newtype" actually makes a lot of
    sense:
    
    1. Deserializers can opt-in to this fairly easily by implementing
       `EnumAccess::newtype_variant_seed`.
    2. Types (implementing `Deserialize`) should "just work" as expected
       because maps, tuples, etc. are preserved.
    Stebalien committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    3394f7b View commit details
    Browse the repository at this point in the history