Struct causal_length::map::Map[][src]

pub struct Map<K, V, Tag, CL> where
    K: Key + Ord,
    V: Value + Hash + Eq + Ord,
    Tag: TagT,
    CL: CausalLength
{ /* fields omitted */ }

Causal Length Map

A CRDT map based on an adaptation of the causal length set.

Map uses the tag for garbage collection of old removed members, and to resolve conflicting values for the same key and causal length.

Implementations

impl<K, V, Tag, CL> Map<K, V, Tag, CL> where
    K: Key + Ord,
    V: Value + Hash + Eq + Ord,
    Tag: TagT,
    CL: CausalLength
[src]

pub fn new() -> Map<K, V, Tag, CL>[src]

Create an empty Map

pub fn get<Q>(&self, key: Q) -> Option<(&V, Tag)> where
    Q: Borrow<K>, 
[src]

Returns a reference to the value and tag corresponding to the key.

pub fn contains<Q>(&self, key: Q) -> bool where
    Q: Borrow<K>, 
[src]

Returns true if the map contains a value for the specified key.

pub fn insert(&mut self, key: K, value: V, tag: Tag) -> Option<(V, Tag)>[src]

Inserts a key, value, and tag into the map.

If the map did not have this key present, None is returned.

If the map did have this key present, the value is updated, and the old value is returned, along with the old tag.

pub fn remove(&mut self, key: K, tag: Tag) -> Option<(V, Tag)>[src]

Remove a key from the map, returning the stored value and tag if the key was in the map.

pub fn iter(&self) -> impl Iterator<Item = (K, V, Tag)> + '_[src]

An iterator visiting all key, value, tag tuples in arbitrary order.

pub fn register_iter(
    &self
) -> impl Iterator<Item = Register<(K, V), Tag, CL>> + '_
[src]

An iterator visiting all delta registers in arbitrary order.

pub fn merge_register(&mut self, delta: Register<(K, V), Tag, CL>, min_tag: Tag)[src]

Merge a delta Register into a map.

Remove deltas with a tag value less than min_tag will be ignored.

pub fn merge(&mut self, other: &Self, min_tag: Tag)[src]

Merge two maps.

Remove deltas with a tag value less than min_tag will be ignored.

pub fn retain(&mut self, min_tag: Tag)[src]

Filter out old remove tombstone deltas from the map.

Remove deltas with a tag value less than min_tag will be removed.

Trait Implementations

impl<K: Clone, V: Clone, Tag: Clone, CL: Clone> Clone for Map<K, V, Tag, CL> where
    K: Key + Ord,
    V: Value + Hash + Eq + Ord,
    Tag: TagT,
    CL: CausalLength
[src]

impl<K: Debug, V: Debug, Tag: Debug, CL: Debug> Debug for Map<K, V, Tag, CL> where
    K: Key + Ord,
    V: Value + Hash + Eq + Ord,
    Tag: TagT,
    CL: CausalLength
[src]

impl<K: Default, V: Default, Tag: Default, CL: Default> Default for Map<K, V, Tag, CL> where
    K: Key + Ord,
    V: Value + Hash + Eq + Ord,
    Tag: TagT,
    CL: CausalLength
[src]

impl<'de, K, V, Tag, CL> Deserialize<'de> for Map<K, V, Tag, CL> where
    K: Key + Ord + Deserialize<'de>,
    V: Value + Hash + Ord + Deserialize<'de>,
    Tag: TagT + Deserialize<'de>,
    CL: CausalLength + Deserialize<'de>, 
[src]

impl<K: Eq, V: Eq, Tag: Eq, CL: Eq> Eq for Map<K, V, Tag, CL> where
    K: Key + Ord,
    V: Value + Hash + Eq + Ord,
    Tag: TagT,
    CL: CausalLength
[src]

impl<K, V, Tag, CL> From<Map<K, V, Tag, CL>> for Set<(K, V), Tag, CL> where
    K: Key + Ord,
    V: Value + Hash + Eq + Ord,
    Tag: TagT,
    CL: CausalLength
[src]

impl<K, V, Tag, CL> From<Set<(K, V), Tag, CL>> for Map<K, V, Tag, CL> where
    K: Key + Ord,
    V: Value + Hash + Eq + Ord,
    Tag: TagT,
    CL: CausalLength
[src]

impl<K: PartialEq, V: PartialEq, Tag: PartialEq, CL: PartialEq> PartialEq<Map<K, V, Tag, CL>> for Map<K, V, Tag, CL> where
    K: Key + Ord,
    V: Value + Hash + Eq + Ord,
    Tag: TagT,
    CL: CausalLength
[src]

impl<K, V, Tag, CL> Serialize for Map<K, V, Tag, CL> where
    K: Key + Ord + Serialize,
    V: Value + Hash + Ord + Serialize,
    Tag: TagT + Serialize,
    CL: CausalLength + Serialize
[src]

impl<K, V, Tag, CL> StructuralEq for Map<K, V, Tag, CL> where
    K: Key + Ord,
    V: Value + Hash + Eq + Ord,
    Tag: TagT,
    CL: CausalLength
[src]

impl<K, V, Tag, CL> StructuralPartialEq for Map<K, V, Tag, CL> where
    K: Key + Ord,
    V: Value + Hash + Eq + Ord,
    Tag: TagT,
    CL: CausalLength
[src]

Auto Trait Implementations

impl<K, V, Tag, CL> RefUnwindSafe for Map<K, V, Tag, CL> where
    CL: RefUnwindSafe,
    K: RefUnwindSafe,
    Tag: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V, Tag, CL> Send for Map<K, V, Tag, CL> where
    CL: Send,
    K: Send,
    Tag: Send,
    V: Send

impl<K, V, Tag, CL> Sync for Map<K, V, Tag, CL> where
    CL: Sync,
    K: Sync,
    Tag: Sync,
    V: Sync

impl<K, V, Tag, CL> Unpin for Map<K, V, Tag, CL> where
    CL: Unpin,
    K: Unpin,
    Tag: Unpin,
    V: Unpin

impl<K, V, Tag, CL> UnwindSafe for Map<K, V, Tag, CL> where
    CL: UnwindSafe,
    K: UnwindSafe,
    Tag: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

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

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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> Value for T where
    T: Clone + Eq
[src]