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

error order when serde a enum field #207

Open
cathaysia opened this issue Jul 12, 2023 · 0 comments · May be fixed by #208
Open

error order when serde a enum field #207

cathaysia opened this issue Jul 12, 2023 · 0 comments · May be fixed by #208

Comments

@cathaysia
Copy link

cathaysia commented Jul 12, 2023

I had this pragram:

use serde::Serialize;

#[derive(Serialize)]
enum Anmial {
    Cat,
    Dog,
}

#[derive(Serialize)]
struct A {
    field: Anmial,
}

fn main() {
    let v = A { field: Anmial::Cat };
    println!("{}", serde_xml_rs::to_string(&v).unwrap());
}

then the result is :

<?xml version="1.0" encoding="UTF-8"?>
<A>
    <Cat>
        <field />
    </Cat>
</A>

what I expect is :

<?xml version="1.0" encoding="UTF-8"?>
<A>
    <Field>
        <Cat />
    </Field>
</A>
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 a pull request may close this issue.

1 participant