Closed EvanCarroll closed 2 years ago
I don't think this is possible: It would require the parent to know the methods of the child, and Rust macros don't have a way to access that data.
serde
is able to support flattening because it doesn't generate methods per-field, so it can wait until runtime and then pass values down to the flattened Deserializer instances. It's very elegant, but it also doesn't work for our use-case.
@ijackson explored nested builders in #254, but that wasn't quite flattening.
It would be nice to be able to flatten structs that also implement builder.