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

Enable the use of #[serde(default)] and #[serde(skip_serialize_if)] for newtype variants in adjacently tagged enums #2509

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Baptistemontan
Copy link
Contributor

This PR enable the use of default and skip_serialize_if for newtype variants in adjacently tagged enums when deriving Serialize and Deserialize.

close #2508.

let func = quote_spanned!(span=> _serde::__private::de::missing_field);
quote! {
#func(#content).map(#this_value::#variant_ident)
let field = &variant.fields[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, this will not work for skipped fields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Improve #[serde(default, skip_serializing_if = "xxx")] behavior on Enum variant value.
2 participants