We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Serialization works, but deserialization not:
#[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(rename_all = "PascalCase")] struct Root { element: Element, #[serde(rename = "$value")] choice: Choice, } #[derive(Debug, serde::Serialize, serde::Deserialize)] struct Element(String); #[derive(Debug, serde::Serialize, serde::Deserialize)] enum Choice { ChoiceOne(String), ChoiceTwo(String), } fn main() { let root = Root { element: Element("element".to_string()), choice: Choice::ChoiceTwo("choice_two".to_string()), }; let s = quick_xml::se::to_string(&root).unwrap(); println!("{:?}", s); let r: Root = quick_xml::de::from_str(&s).unwrap(); println!("{:?}", r); }
Serialization:
<Root><Element>element</Element><ChoiceTwo>choice_two</ChoiceTwo></Root>
Deserialization error:
'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom("unknown variant `Element`, expected `ChoiceOne` or `ChoiceTwo`")'
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Serialization works, but deserialization not:
Serialization:
Deserialization error:
The text was updated successfully, but these errors were encountered: