pub struct GSet<T: Ord + Clone> { /* private fields */ }Expand description
A Grow-only Set (GSet) CRDT.
The simplest useful CRDT: elements can only be added, never removed. The join operation is set union, which is commutative, associative, and idempotent by definition.
§Example
use mdcs_core::GSet;
use mdcs_core::Lattice;
let mut a = GSet::new();
a.insert("hello");
let mut b = GSet::new();
b.insert("world");
let merged = a.join(&b);
assert!(merged.contains(&"hello"));
assert!(merged.contains(&"world"));Implementations§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for GSet<T>
impl<'de, T> Deserialize<'de> for GSet<T>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: Ord + Clone> Lattice for GSet<T>
impl<T: Ord + Clone> Lattice for GSet<T>
Source§fn join(&self, other: &Self) -> Self
fn join(&self, other: &Self) -> Self
Join operation (least upper bound)
Must be commutative, associative, and idempotent
Source§fn partial_cmp_lattice(&self, other: &Self) -> Option<Ordering>
fn partial_cmp_lattice(&self, other: &Self) -> Option<Ordering>
Partial order derived from join: a ≤ b iff a ⊔ b = b
Source§fn join_assign(&mut self, other: &Self)
fn join_assign(&mut self, other: &Self)
Join-assign: self = self ⊔ other
impl<T: Eq + Ord + Clone> Eq for GSet<T>
impl<T: Ord + Clone> StructuralPartialEq for GSet<T>
Auto Trait Implementations§
impl<T> Freeze for GSet<T>
impl<T> RefUnwindSafe for GSet<T>where
T: RefUnwindSafe,
impl<T> Send for GSet<T>where
T: Send,
impl<T> Sync for GSet<T>where
T: Sync,
impl<T> Unpin for GSet<T>
impl<T> UnwindSafe for GSet<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more