I noticed that when using #[serde(flatten)] and serializing to RON, I'm not able to deserialize the resulting RON . It's also worth noting, that it changed the outer struct's RON representation from a struct to a map.
So now I'm wondering where to report this issue. Is it a problem with the ron or serde crate? Or maybe I'm using it wrong somehow?
Here is an example of the issue:
#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq)]
struct Foo {
a: String,
#[serde(flatten)] // No errors without this
bar: Bar,
}
#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq)]
struct Bar {
b: String,
}
fn main() {
let original = Foo {
a: "1".into(),
bar: Bar {
b: "2".into()
}
};
let ser = ron::ser::to_string(&original).unwrap();
println!("{ser}\n");
let de: Foo = ron::de::from_str(&ser).expect("deserialize");
println!("{de:?}");
assert_eq!(original, de);
}