pub trait ExtendBuilder {
// Required method
fn extend_from(&mut self, other: Self, strategy: ExtendStrategy);
}
Expand description
A builder that can be extended from another builder.
Required Methods§
Sourcefn extend_from(&mut self, other: Self, strategy: ExtendStrategy)
fn extend_from(&mut self, other: Self, strategy: ExtendStrategy)
Consume other
, and merge its contents into self
.
Generally, whenever a field is set in other
,
it should replace any corresponding field in self
.
Unset fields in other
should have no effect.
We use this trait to implement map-style configuration options that need to have defaults. Rather than simply replacing the maps wholesale (as would happen with serde defaults ordinarily) we use this trait to copy inner options from the provided options over the defaults in the most fine-grained manner possible.
§When strategy
is ExtendStrategy::ReplaceLists
:
(No other strategies currently exist.)
Every simple option that is set in other
should be moved into self
,
replacing a previous value (if there was one).
Every list option that is set in other
should be moved into self
,
replacing a previous value (if there was one).
Any complex option (one with an internal tree structure) that is set in other
should recursively be extended, replacing each piece of it that is set in other.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.