Skip to main content

Merge

Trait Merge 

Source
pub trait Merge {
    // Required method
    fn merge(&mut self, other: &Self);
}
Expand description

A type that can be merged with another instance of itself.

The merge operation must satisfy CRDT properties:

  • Commutative: a.merge(b) == b.merge(a) (result is the same regardless of order)
  • Associative: a.merge(b.merge(c)) == a.merge(b).merge(c)
  • Idempotent: a.merge(a) == a (merging with self has no effect)

These properties ensure that replicas converge to the same state regardless of message ordering or delivery.

Required Methods§

Source

fn merge(&mut self, other: &Self)

Merge another instance into self.

After merging, self contains the combined state of both instances.

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.

Implementors§

Source§

impl Merge for VClock

Source§

impl Merge for GCounter

Source§

impl Merge for PNCounter

Source§

impl<K: Hash + Eq + Clone, V: Merge + Default + Clone> Merge for ORMap<K, V>

Source§

impl<T: Clone + PartialEq> Merge for RGA<T>

Source§

impl<T: Clone + PartialEq> Merge for YATA<T>

Source§

impl<T: Clone + PartialEq> Merge for MVRegister<T>

Source§

impl<T: Clone> Merge for LWWRegister<T>

Source§

impl<T: Hash + Eq + Clone, B: SetBias> Merge for ORSet<T, B>