Struct crdts::gset::GSet [−][src]
pub struct GSet<T: Ord> { /* fields omitted */ }
A GSet
is a grow-only set.
Implementations
impl<T: Ord> GSet<T>
[src]
pub fn new() -> Self
[src]
Instantiates an empty GSet
.
pub fn insert(&mut self, element: T)
[src]
Inserts an element into this GSet
.
Examples
use crdts::GSet; let mut a = GSet::new(); a.insert(1); assert!(a.contains(&1));
pub fn contains(&self, element: &T) -> bool
[src]
Returns true
if the GSet
contains the element.
Examples
use crdts::GSet; let mut a = GSet::new(); a.insert(1); assert!(a.contains(&1));
pub fn read(&self) -> BTreeSet<T> where
T: Clone,
[src]
T: Clone,
Returns the BTreeSet
for this GSet
.
Examples
use crdts::GSet; use std::collections::BTreeSet; let mut a = GSet::new(); let mut b = BTreeSet::new(); for i in 1..10 { a.insert(i); b.insert(i); } assert_eq!(a.read(), b);
Trait Implementations
impl<T: Clone + Ord> Clone for GSet<T>
[src]
impl<T: Ord> CmRDT for GSet<T>
[src]
type Op = T
Op defines a mutation to the CRDT. As long as Op’s from one actor are replayed in exactly the same order they were generated by that actor, the CRDT will converge. In other words, we must have a total ordering on each actors operations, while requiring only a partial order over all ops. E.g. Read more
type Validation = Infallible
The validation error returned by validate_op
.
fn validate_op(&self, _op: &Self::Op) -> Result<(), Self::Validation>
[src]
fn apply(&mut self, op: Self::Op)
[src]
impl<T: Ord> CvRDT for GSet<T>
[src]
type Validation = Infallible
The validation error returned by validate_merge
.
fn validate_merge(&self, _other: &Self) -> Result<(), Self::Validation>
[src]
fn merge(&mut self, other: Self)
[src]
Merges another GSet
into this one.
Examples
use crdts::{GSet, CvRDT, CmRDT}; let (mut a, mut b) = (GSet::new(), GSet::new()); a.insert(1); b.insert(2); a.merge(b); assert!(a.contains(&1)); assert!(a.contains(&2));
impl<T: Debug + Ord> Debug for GSet<T>
[src]
impl<T: Ord> Default for GSet<T>
[src]
impl<'de, T: Ord> Deserialize<'de> for GSet<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T: Eq + Ord> Eq for GSet<T>
[src]
impl<T: Hash + Ord> Hash for GSet<T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: PartialEq + Ord> PartialEq<GSet<T>> for GSet<T>
[src]
impl<T: Ord> Serialize for GSet<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<T: Ord> StructuralEq for GSet<T>
[src]
impl<T: Ord> StructuralPartialEq for GSet<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for GSet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for GSet<T> where
T: Send,
T: Send,
impl<T> Sync for GSet<T> where
T: Sync,
T: Sync,
impl<T> Unpin for GSet<T>
impl<T> UnwindSafe for GSet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,