Merge

Trait Merge 

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

A trait representing a merge operation (monoid) over values of the same type.

Types implementing Merge must also implement Default, which serves as the identity element. The merge method combines other into self, consuming other. Implementations should respect monoid laws:

  • left identity: Default::default().merge(x) yields x (up to equivalence)
  • right identity: x.merge(Default::default()) yields x (up to equivalence)
  • associativity: (x.merge(y)).merge(z) yields the same result as x.merge(y.merge(z)).

Required Methods§

Source

fn merge(&mut self, other: Self)

Merge other into self, consuming 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.

Implementors§

Source§

impl<E: Clone> Merge for EventLog<E>

Source§

impl<T: Default> Merge for Fixed<T>

Source§

impl<T: Merge> Merge for SharedState<T>