Skip to content
New issue

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

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

Already on GitHub? # to your account

Support #[serde(untagged)] #31

Open
wagmi-lotech opened this issue Jan 10, 2025 · 0 comments
Open

Support #[serde(untagged)] #31

wagmi-lotech opened this issue Jan 10, 2025 · 0 comments

Comments

@wagmi-lotech
Copy link

It would be great if we could define catch-all variant that would retain underlying data on deserialization. While this library does support #[serde(other)] already for a catch-all variant, this discards the data. It would be great if we could instead use #[serde(untagged)] - obviously just over a newtype-style variant with a single value that matches repr type:

#[derive(Deserialize_repr)]
#[repr(u8)]
enum Code {
    SomethingWentWrong = 5,
    SomeOtherError = 6,
    #[serde(untagged)]
    Other(u8),
}
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant