You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to be able to flatten structs that also implement builder.
#[derive(builder)]structFoo{bar:u32}#[derive(builder)]structBaz{#[builder(flatten)]foo:Foo// which itself derives Builder}// .bar() here comes from flattening `foo`let baz = BazBuilder::from().bar(42).build().unwrap();
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: