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

serde De/Serializing Option<u64> fails #785

Closed
jonaspleyer opened this issue Jul 15, 2024 · 1 comment
Closed

serde De/Serializing Option<u64> fails #785

jonaspleyer opened this issue Jul 15, 2024 · 1 comment
Labels
duplicate serde Issues related to mapping from Rust types to XML

Comments

@jonaspleyer
Copy link

jonaspleyer commented Jul 15, 2024

Hi,

I have some code in which I need to (de)-serialize in the following way:

#[test]
fn issue785() {
    #[derive(Debug, Deserialize, Eq, PartialEq, Serialize)]
    struct Identifier {
        parent: Option<u64>,
    }
    let ident = Identifier {
        parent: None,
    };
    let mut save_string = String::new();
    let mut serializer = quick_xml::se::Serializer::new(&mut save_string);
    serializer.indent(' ', 4);
    ident.serialize(serializer).unwrap();
    let res: Identifier = quick_xml::de::from_str(&save_string).unwrap();
    assert_eq!(res, ident);
}

This test does however fail with the current implementation of quick-xml. I have narrowed it down to the deserialize_option function of the MapValueDeserializer struct in src/de/map.rs. Sadly, I do not understand enough about the internals of quick-xml to contribute anything meaningful. Please let know how I can further help if needed.

PS: I have created a PR #786 to work on this problem.

@Mingun Mingun added duplicate serde Issues related to mapping from Rust types to XML labels Jul 16, 2024
@Mingun
Copy link
Collaborator

Mingun commented Jul 16, 2024

Duplicate of #497

@Mingun Mingun marked this as a duplicate of #497 Jul 16, 2024
@Mingun Mingun closed this as not planned Won't fix, can't repro, duplicate, stale Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate serde Issues related to mapping from Rust types to XML
Projects
None yet
Development

No branches or pull requests

2 participants