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

pub struct GCounter<A: Ord> { /* fields omitted */ }
Expand description

GCounter is a grow-only witnessed counter.

Examples

use crdts::{GCounter, CmRDT};

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

a.apply(a.inc("A"));
b.apply(b.inc("B"));

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

a.apply(a.inc("A"));
assert!(a.read() > b.read());

Implementations

Produce a new GCounter.

Generate Op to increment the counter.

Generate Op to increment the counter by a number of steps.

Return the current sum of this counter.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

The validation error returned by validate_op.

Some CRDT’s have stricter requirements on how they must be used. To avoid violating these requirements, CRDT’s provide an interface to optionally validate op’s before they are applied. Read more

Apply an Op to the CRDT

The validation error returned by validate_merge.

Some CRDT’s have stricter requirements on how they must be used. To avoid violating these requirements, CRDT’s provide an interface to optionally validate merge compatibility before attempting to merge. Read more

Merge the given CRDT into the current CRDT.

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Remove data that is strictly smaller than this clock

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.