Struct crdts::gcounter::GCounter
[−]
[src]
pub struct GCounter<A: Ord + Clone> { // some fields omitted }
GCounter
is a grow-only witnessed counter.
Examples
use crdts::GCounter; let (mut a, mut b) = (GCounter::new(), GCounter::new()); a.increment("A"); b.increment("B"); assert_eq!(a.value(), b.value()); assert!(a == b); a.increment("A"); assert!(a > b);
Methods
impl<A: Ord + Clone> GCounter<A>
[src]
fn new() -> GCounter<A>
Produces a new GCounter
.
fn increment(&mut self, actor: A)
Increments a particular actor's counter.
fn value(&self) -> u64
Returns the current sum of this counter.
Trait Implementations
impl<A: Hash + Ord + Clone> Hash for GCounter<A>
[src]
fn hash<__HA: Hasher>(&self, __arg_0: &mut __HA)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl<A: Clone + Ord + Clone> Clone for GCounter<A>
[src]
fn clone(&self) -> GCounter<A>
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
impl<A: Eq + Ord + Clone> Eq for GCounter<A>
[src]
impl<A: Debug + Ord + Clone> Debug for GCounter<A>
[src]
impl<A: Ord + Clone> Ord for GCounter<A>
[src]
fn cmp(&self, other: &GCounter<A>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<A: Ord + Clone> PartialOrd for GCounter<A>
[src]
fn partial_cmp(&self, other: &GCounter<A>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more