Struct orset::ORSet
[−]
[src]
pub struct ORSet<T: Eq + Hash> { pub name: String, // some fields omitted }
A state based Observe-Remove Set with delta mutation
Fields
name: String
Methods
impl<T: Eq + Hash + Clone> ORSet<T>
[src]
fn new(name: String) -> ORSet<T>
Create a new instance of an ORSet
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
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.
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
fn join_state(&mut self, from: ORSet<T>) -> bool
Merge another ORSet into this ORSet
Returns true if the state was mutated, false otherwise
fn join(&mut self, delta: Delta<T>) -> bool
Merge a delta into an ORSet
Returns true if the state was mutated, false otherwise
fn contains(&self, element: &T) -> bool
Check if an ORSet contains an element
fn elements(&self) -> Vec<T>
Return the elements in an ORSet
Trait Implementations
impl<T: Debug + Eq + Hash> Debug for ORSet<T>
[src]
impl<T: Clone + Eq + Hash> Clone for ORSet<T>
[src]
fn clone(&self) -> ORSet<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more