[−][src]Trait crdts::FunkyCvRDT
Funky variant of the CvRDT
trait.
This trait is for CvRDT's whose state space can't be easily encoded in rusts typesystem so we rely on runtime error checking. E.g. the unicity of timestamp assumption in LWWReg
Associated Types
Loading content...Required methods
fn merge(&mut self, other: Self) -> Result<(), Self::Error>
Merge the given CRDT into the current CRDT.
Implementors
impl<V: Val, M: Marker> FunkyCvRDT for LWWReg<V, M>
[src]
type Error = Error
fn merge(
&mut self,
LWWReg { val: val, marker: marker }: Self
) -> Result<(), Error>
[src]
&mut self,
LWWReg { val: val, marker: marker }: Self
) -> Result<(), Error>
Combines two LWWReg
instances according to the marker that
tracks causality. Returns an error if the marker is identical but the
contained element is different.
use crdts::{LWWReg, FunkyCvRDT}; let mut l1 = LWWReg { val: 1, marker: 2 }; let l2 = LWWReg { val: 3, marker: 2 }; // errors! assert!(l1.merge(l2).is_err());