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

Added '$struct' tag to identify structs in newtype enum variants. #359

Closed
wants to merge 2 commits into from

Conversation

gimait
Copy link

@gimait gimait commented Feb 16, 2022

Trying out the serialization options included in quick-xml I came across an issue with the serialization of newtype variants in enums, where structs would have duplicated nodes when serialized. This relates to open issues like #183 and #346.

I believe there might be a better way to do this, but a very basic concept I came up with is to simply mark which enum variants contain a struct, and then skip adding an extra node for such variant.

This makes it for me for now, and maybe some others could benefit from it until we find the right way to do it.
I would like to look into an automatic way of doing this if someone has any ideas of how I could detect automatically if the given newvariant is a struct.

Let me know what you think, any feedback is welcome :)

@gimait
Copy link
Author

gimait commented Feb 28, 2022

I'm doing some more work on this for a project I'm working on, and in the meanwhile, I'm seeing other features that I'm missing for serde. I'll close this PR for now and create a new more complete one later on, including a proposal to include those features.

@gimait gimait closed this Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant