#[derive(Merge)]
{
// Attributes available to this derive:
#[merge]
}
Expand description
Derive the Merge trait.
This macro can be used only on struct items.
Generate a Merge implementation for the annotated type. The generated code
calls .merge and .merge_ref on each field.
§Field attributes
§rename
- Syntax:
#[merge(rename = "foo")]
Rename a field so it appears under a different name in the error context.
§skip
- Syntax:
#[merge(skip)]
Completely skip merging this field. This instructs the macro to not emit
code for merging the field. Skipped fields retain the value of self.
§with
- Syntax:
#[merge(with = path::to::custom::merge)]
Use $module::merge and $module::merge_ref to merge this field instead of
its own Merge implementation.
This can be used to make external types Merge without having to use
newtypes.