pub struct ORSet<T: Eq + Hash> {
pub name: String,
/* private fields */
}
Expand description
A state based Observe-Remove Set with delta mutation
Fields§
§name: String
Implementations§
Source§impl<T: Eq + Hash + Clone> ORSet<T>
impl<T: Eq + Hash + Clone> ORSet<T>
Sourcepub fn seen(&self, element: &T) -> Option<Vec<Dot>>
pub fn seen(&self, element: &T) -> Option<Vec<Dot>>
Return any observed dots for a given element or None if the element has not been seen
Sourcepub fn add(&mut self, element: T) -> Delta<T>
pub fn add(&mut self, element: T) -> Delta<T>
Add an element to an ORSet
This method creates a new dot for the element and puts it in the add set. It returns the delta mutator representing the add.
Sourcepub fn remove(&mut self, element: T, seen: Vec<Dot>) -> Delta<T>
pub fn remove(&mut self, element: T, seen: Vec<Dot>) -> Delta<T>
Remove an element from an ORSet by passing in the element and it’s observed dots
This method returns a delta mutator representing the remove operation.
Invariant: seen can never be empty
Sourcepub fn join_state(&mut self, from: ORSet<T>) -> bool
pub fn join_state(&mut self, from: ORSet<T>) -> bool
Merge another ORSet into this ORSet
Returns true if the state was mutated, false otherwise
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
impl<T: Eq + Eq + Hash> Eq for ORSet<T>
impl<T: Eq + Hash> StructuralPartialEq 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> 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