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

Allow enum variants to be serialized as empty tags #3

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

leftmostcat
Copy link
Collaborator

This brings enum variants in line with structs, wherein structures which have no fields which are represented as child nodes are serialized as empty tags. This is, generally-speaking, cosmetic only.

An example enum:

enum Foo {
    Bar {
        #[xml_struct(attribute)]
        baz: &'static str,
    }
}

Prior to this change, Foo::Bar { baz: "qux" } would be serialized as follows:

<Bar Baz="qux"></Bar>

Following this change, it will be serialized as follows:

<Bar Baz="qux"/>

Copy link
Member

@babolivier babolivier left a comment

Choose a reason for hiding this comment

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

lgtm

cat_button

@leftmostcat leftmostcat merged commit 57662c9 into main Apr 23, 2024
2 checks passed
@leftmostcat leftmostcat deleted the empty-variant-tags branch April 23, 2024 19:23
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.

2 participants