[][src]Struct crdts::gcounter::GCounter

pub struct GCounter<A: Actor> { /* fields omitted */ }

GCounter is a grow-only witnessed counter.


use crdts::{GCounter, CmRDT};

let mut a = GCounter::new();
let mut b = GCounter::new();


assert_eq!(a.read(), b.read());

assert!(a.read() > b.read());


impl<A: Actor> GCounter<A>[src]

pub fn new() -> Self[src]

Produce a new GCounter.

pub fn inc(&self, actor: A) -> Dot<A>[src]

Generate Op to increment the counter.

pub fn read(&self) -> BigUint[src]

Return the current sum of this counter.

Trait Implementations

impl<A: Actor> CvRDT for GCounter<A>[src]

impl<A: Actor> CmRDT for GCounter<A>[src]

type Op = Dot<A>

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

impl<A: Actor> Causal<A> for GCounter<A>[src]

impl<A: Clone + Actor> Clone for GCounter<A>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<A: Eq + Actor> Eq for GCounter<A>[src]

impl<A: Actor> Default for GCounter<A>[src]

impl<A: PartialEq + Actor> PartialEq<GCounter<A>> for GCounter<A>[src]

impl<A: Hash + Actor> Hash for GCounter<A>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher

Feeds a slice of this type into the given [Hasher]. Read more

impl<A: Debug + Actor> Debug for GCounter<A>[src]

impl<A: Actor> Serialize for GCounter<A> where
    A: Serialize

impl<'de, A: Actor> Deserialize<'de> for GCounter<A> where
    A: Deserialize<'de>, 

Auto Trait Implementations

impl<A> Sync for GCounter<A> where
    A: Sync

impl<A> Unpin for GCounter<A> where
    A: Unpin

impl<A> Send for GCounter<A> where
    A: Send

impl<A> RefUnwindSafe for GCounter<A> where
    A: RefUnwindSafe

impl<A> UnwindSafe for GCounter<A> where
    A: RefUnwindSafe + UnwindSafe

Blanket Implementations

impl<T> Val for T where
    T: PartialEq<T> + Clone + Debug

impl<T> Val for T where
    T: Clone + Debug

impl<T> Member for T where
    T: Eq + Clone + Hash + Debug

impl<A, T> Val<A> for T where
    A: Actor,
    T: Debug + Default + Clone + Causal<A> + CmRDT + CvRDT

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>,