Skip to main content

Merge

Trait Merge 

Source
pub trait Merge<Other> {
    // Required method
    fn merge(&mut self, other: Other) -> bool;

    // Provided method
    fn merge_owned(this: Self, delta: Other) -> Self
       where Self: Sized { ... }
}
Expand description

Trait for lattice merge (AKA “join” or “least upper bound”).

Required Methods§

Source

fn merge(&mut self, other: Other) -> bool

Merge other into the self lattice.

This operation must be associative, commutative, and idempotent.

Returns true if self changed, false otherwise. Returning true implies that the new value for self is later in the lattice order than the old value. Returning false means that self was unchanged and therefore other came before self (or the two are equal) in the lattice order.

Provided Methods§

Source

fn merge_owned(this: Self, delta: Other) -> Self
where Self: Sized,

Merge this and delta together, returning the new value.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Merge<()> for ()

Source§

fn merge(&mut self, _other: Self) -> bool

Implementors§

Source§

impl<Head, Node> Merge<GhtInner<Head, Node>> for GhtInner<Head, Node>
where Node: GeneralizedHashTrieNode + Merge<Node>, Node::Storage: VariadicSet<Schema = Node::Schema>, Self: GeneralizedHashTrieNode, Head: Hash + Eq + Clone,

Available on crate feature std only.
Source§

impl<Inner, Other> Merge<WithBot<Other>> for WithBot<Inner>
where Inner: Merge<Other> + LatticeFrom<Other>, Other: IsBot,

Source§

impl<Inner, Other> Merge<WithTop<Other>> for WithTop<Inner>
where Inner: Merge<Other> + LatticeFrom<Other>,

Source§

impl<Item, SetSelf, TombstoneSetSelf, SetOther, TombstoneSetOther> Merge<SetUnionWithTombstones<SetOther, TombstoneSetOther>> for SetUnionWithTombstones<SetSelf, TombstoneSetSelf>
where SetSelf: Extend<Item> + Len + for<'a> Remove<&'a Item>, SetOther: IntoIterator<Item = Item>, TombstoneSetSelf: TombstoneSet<Item>, TombstoneSetOther: IntoIterator<Item = Item>,

Available on crate feature std only.
Source§

impl<KeySelf, KeyOther, ValSelf, ValOther> Merge<DomPair<KeyOther, ValOther>> for DomPair<KeySelf, ValSelf>
where KeySelf: Merge<KeyOther> + LatticeFrom<KeyOther> + PartialOrd<KeyOther>, ValSelf: Merge<ValOther> + LatticeFrom<ValOther>,

Source§

impl<LatA, LatB, __LatAOther, __LatBOther> Merge<Pair<__LatAOther, __LatBOther>> for Pair<LatA, LatB>
where LatA: Merge<__LatAOther>, LatB: Merge<__LatBOther>,

Source§

impl<LatSelf, LatOther> Merge<VecUnion<LatOther>> for VecUnion<LatSelf>
where LatSelf: Merge<LatOther> + LatticeFrom<LatOther>,

Available on crate feature alloc only.
Source§

impl<MapSelf, MapOther, K, ValSelf, ValOther, TombstoneSetSelf, TombstoneSetOther> Merge<MapUnionWithTombstones<MapOther, TombstoneSetOther>> for MapUnionWithTombstones<MapSelf, TombstoneSetSelf>
where MapSelf: Keyed<Key = K, Item = ValSelf> + Extend<(K, ValSelf)> + for<'a> GetMut<&'a K, Item = ValSelf> + for<'b> Remove<&'b K>, MapOther: IntoIterator<Item = (K, ValOther)>, ValSelf: Merge<ValOther> + LatticeFrom<ValOther>, ValOther: IsBot, TombstoneSetSelf: TombstoneSet<K>, TombstoneSetOther: IntoIterator<Item = K>,

Available on crate feature std only.

Merge implementation using TombstoneSet trait for optimized union operations

Source§

impl<MapSelf, MapOther, K, ValSelf, ValOther> Merge<MapUnion<MapOther>> for MapUnion<MapSelf>
where MapSelf: Keyed<Key = K, Item = ValSelf> + Extend<(K, ValSelf)> + for<'a> GetMut<&'a K, Item = ValSelf>, MapOther: IntoIterator<Item = (K, ValOther)>, ValSelf: Merge<ValOther> + LatticeFrom<ValOther>, ValOther: IsBot,

Available on crate feature alloc only.
Source§

impl<MapSelf, MapOther, K> Merge<UnionFind<MapOther>> for UnionFind<MapSelf>
where MapSelf: MapMut<K, Cell<K>, Key = K, Item = Cell<K>>, MapOther: IntoIterator<Item = (K, Cell<K>)>, K: Copy + Eq,

Available on crate feature std only.
Source§

impl<Schema, ValType, Storage> Merge<GhtLeaf<Schema, ValType, Storage>> for GhtLeaf<Schema, ValType, Storage>
where Schema: Eq + Hash, Storage: VariadicSet<Schema = Schema> + Extend<Schema> + IntoIterator<Item = Schema>,

Available on crate feature std only.
Source§

impl<SetSelf, SetOther, Item> Merge<SetUnion<SetOther>> for SetUnion<SetSelf>
where SetSelf: Extend<Item> + Len, SetOther: IntoIterator<Item = Item>,

Source§

impl<T, O> Merge<Conflict<O>> for Conflict<T>
where T: PartialEq<O>,

Source§

impl<T, Provenance> Merge<Point<T, Provenance>> for Point<T, Provenance>
where T: PartialEq,

Source§

impl<T> Merge<Max<T>> for Max<T>
where T: Ord,

Source§

impl<T> Merge<Min<T>> for Min<T>
where T: Ord,