pub struct OrSet<T>{ /* private fields */ }Expand description
Observed-Remove Set
A CRDT set that supports add and remove operations. Each add operation gets a unique ID, and removes only affect observed add operations. This ensures that concurrent add/remove operations are handled correctly.
§Example
use oxigdal_sync::crdt::{OrSet, Crdt};
let mut set1 = OrSet::new("device-1".to_string());
set1.insert("apple".to_string());
set1.insert("banana".to_string());
let mut set2 = OrSet::new("device-2".to_string());
set2.insert("cherry".to_string());
set1.merge(&set2).ok();
assert_eq!(set1.len(), 3);Implementations§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for OrSet<T>
impl<'de, T> Deserialize<'de> for OrSet<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> DeviceAware for OrSet<T>
impl<T> DeviceAware for OrSet<T>
Auto Trait Implementations§
impl<T> Freeze for OrSet<T>
impl<T> RefUnwindSafe for OrSet<T>where
T: RefUnwindSafe,
impl<T> Send for OrSet<T>where
T: Send,
impl<T> Sync for OrSet<T>where
T: Sync,
impl<T> Unpin for OrSet<T>where
T: Unpin,
impl<T> UnsafeUnpin for OrSet<T>
impl<T> UnwindSafe for OrSet<T>where
T: UnwindSafe,
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