pub fn merge<A: Clone>(
base: BuildOutput<A>,
overlay: BuildOutput<A>,
) -> Merged<A>Expand description
Merges a base (defaults) BuildOutput with an overlay (user config)
BuildOutput, returning the combined result with advisory notes.
§Merge semantics
- Layers: the layer sets are unioned. For each layer name present in
both
baseandoverlay, bindings are merged chord-by-chord: the overlay chord wins silently (it is the user’s override). AMergeNote::Overrodeis emitted for each overridden chord. - Tombstones (
overlay.unbinds): for each chord listed as an unbind in the overlay, the chord is removed from the corresponding base layer (if present). AMergeNote::Unboundnote is emitted for successful removals;MergeNote::UnbindMisswhen the chord was absent from the base. - Sequences: the overlay’s sequences are folded into the base’s. An
exact-match sequence in the overlay silently replaces the base’s. A sequence
in the overlay that is a prefix of (or is prefixed by) a sequence in the
base causes the base sequence to be dropped; a
MergeNote::DroppedSequencenote is emitted. - Warnings: the merged
output.warningsis the concatenation ofbase.warningsandoverlay.warnings. Merge notes go tonotes, never tooutput.warnings.
Override operations are intentionally silent in output.warnings so that a
caller gating on output.warnings.is_empty() (deny-warnings mode) is not
triggered by the user legitimately overriding a default binding.
§Bound: A: Clone
merge requires A: Clone because it copies actions from the overlay
into the merged map. SequenceKeymap::bindings yields shared references
only (there is no by-value iterator), so cloning is the only way to move
sequence actions across maps without unsafe code. This bound is on merge
alone and is not propagated to any core type.