macro_rules! derive_deftly_template_ExtendBuilder {
({ $($driver:tt)* } [$($aoptions:tt)*] ($($future:tt)*) $($tpassthrough:tt)*) => { ... };
($($wrong:tt)*) => { ... };
}Expand description
Provide an ExtendBuilder implementation for a struct’s builder.
This template is only sensible when used alongside #[derive(Builder)].
The provided extend_from function will behave as:
- For every non-
sub_builderfield, if there is a value set inother, replace the value inself(if any) with that value. (Otherwise, leave the value inselfas it is). - For every
sub_builderfield, recursively useextend_fromto extend that builder from the corresponding builder inother.
§Interaction with sub_builder.
When a field in the struct is tagged with #[builder(sub_builder)],
you must also tag the same field with #[deftly(extend_builder(sub_builder))];
otherwise, compilation will fail.
§Interaction with strip_option and default.
The flags have no special effect on the ExtendBuilder, and will work fine.
(See comments in the code for details about why, and what this means.
Remember, builder(default) is applied when build() is called,
and does not automatically cause an un-set option to count as set.)
This is a derive_deftly template. Do not invoke it directly.
To use it, write: #[derive(Deftly)] #[derive_deftly(ExtendBuilder)].