This repository was archived by the owner on Mar 25, 2024. It is now read-only.
This repository was archived by the owner on Mar 25, 2024. It is now read-only.
Open
Description
In the following example the first struct deserializes , but the second one fails with "invalid type: integer 42
, expected a string".
use serde::Deserialize;
#[derive(Deserialize)]
struct Inner {
x: String,
}
#[derive(Deserialize)]
struct S {
#[serde(flatten)]
inner: Inner,
}
fn main() {
let t = "x: 42";
let v: Inner = serde_yaml::from_str(t).unwrap();
println!("{}", v.x);
let v: S = serde_yaml::from_str(t).unwrap();
println!("{}", v.inner.x);
}
Metadata
Metadata
Assignees
Labels
No labels