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
use yaserde_derive::YaSerialize; #[derive(Default, YaSerialize)] struct A { #[yaserde(attribute)] val: u8 } #[derive(Default, YaSerialize)] struct B { val: u8 } #[derive(YaSerialize)] enum MainNode { A(A), B(B), } #[derive(Default, YaSerialize)] struct Main { #[yaserde(child, flatten)] m: Vec<MainNode> } fn sample() -> Main { Main { m: vec![ MainNode::A( A{val: 1} ), MainNode::B( B{val: 2} ) ] } } fn main() { let node = sample(); println!("{}", yaserde::ser::to_string(&node).unwrap()); } #[cfg(test)] mod tests { const XML: &str = r##"<?xml version="1.0" encoding="utf-8"?><Main><A val="1" /><B><val>2</val></B></Main>"##; use crate::sample; #[test] fn attribute() { let node = sample(); let data = yaserde::ser::to_string(&node).unwrap(); assert_eq!(data, XML); } }
the A::val is not serialized from Main structure.
The text was updated successfully, but these errors were encountered:
I have the same issue and will try to debug.
Sorry, something went wrong.
Found something and created a PR #167
No branches or pull requests
the A::val is not serialized from Main structure.
The text was updated successfully, but these errors were encountered: