[][src]Struct crdts::map::Map

pub struct Map<K: Key, V: Val<A>, A: Actor> { /* fields omitted */ }

Map CRDT - Supports Composition of CRDT's with reset-remove semantics.

Reset-remove means that if one replica removes an entry while another actor concurrently edits that entry, once we sync these two maps, we will see that the entry is still in the map but all edits seen by the removing actor will be gone.

See examples/reset_remove.rs for an example of reset-remove semantics in action.

Methods

impl<K: Key, V: Val<A>, A: Actor> Map<K, V, A>[src]

pub fn new() -> Self[src]

Constructs an empty Map

pub fn is_empty(&self) -> ReadCtx<bool, A>[src]

Returns true if the map has no entries, false otherwise

pub fn len(&self) -> ReadCtx<usize, A>[src]

Returns the number of entries in the Map

pub fn get(&self, key: &K) -> ReadCtx<Option<V>, A>[src]

Retrieve value stored under a key

pub fn update<F, I>(&self, key: I, ctx: AddCtx<A>, f: F) -> Op<K, V, A> where
    F: FnOnce(&V, AddCtx<A>) -> V::Op,
    I: Into<K>, 
[src]

Update a value under some key, if the key is not present in the map, the updater will be given the result of V::default().

pub fn rm(&self, key: impl Into<K>, ctx: RmCtx<A>) -> Op<K, V, A>[src]

Remove an entry from the Map

Trait Implementations

impl<K: Key, V: Val<A>, A: Actor> CvRDT for Map<K, V, A>[src]

impl<K: Key, V: Val<A>, A: Actor> CmRDT for Map<K, V, A>[src]

type Op = Op<K, V, 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<K: Key, V: Val<A>, A: Actor> Causal<A> for Map<K, V, A>[src]

impl<K: PartialEq + Key, V: PartialEq + Val<A>, A: PartialEq + Actor> PartialEq<Map<K, V, A>> for Map<K, V, A>[src]

impl<K: Eq + Key, V: Eq + Val<A>, A: Eq + Actor> Eq for Map<K, V, A>[src]

impl<K: Key, V: Val<A>, A: Actor> Default for Map<K, V, A>[src]

impl<K: Clone + Key, V: Clone + Val<A>, A: Clone + Actor> Clone for Map<K, V, A>[src]

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

Performs copy-assignment from source. Read more

impl<K: Debug + Key, V: Debug + Val<A>, A: Debug + Actor> Debug for Map<K, V, A>[src]

impl<K: Key, V: Val<A>, A: Actor> Serialize for Map<K, V, A> where
    K: Serialize,
    V: Serialize,
    A: Serialize
[src]

impl<'de, K: Key, V: Val<A>, A: Actor> Deserialize<'de> for Map<K, V, A> where
    K: Deserialize<'de>,
    V: Deserialize<'de>,
    A: Deserialize<'de>, 
[src]

Auto Trait Implementations

impl<K, V, A> Send for Map<K, V, A> where
    A: Send,
    K: Send,
    V: Send

impl<K, V, A> Unpin for Map<K, V, A> where
    A: Unpin,
    K: Unpin,
    V: Unpin

impl<K, V, A> Sync for Map<K, V, A> where
    A: Sync,
    K: Sync,
    V: Sync

impl<K, V, A> UnwindSafe for Map<K, V, A> where
    A: RefUnwindSafe + UnwindSafe,
    K: RefUnwindSafe + UnwindSafe,
    V: RefUnwindSafe + UnwindSafe

impl<K, V, A> RefUnwindSafe for Map<K, V, A> where
    A: RefUnwindSafe,
    K: RefUnwindSafe,
    V: RefUnwindSafe

Blanket Implementations

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

impl<T> Val for T where
    T: Clone + Debug
[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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