pub struct Map<K, V, Tag, CL>{ /* private fields */ }Expand description
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§
Source§impl<K, V, Tag, CL> Map<K, V, Tag, CL>
impl<K, V, Tag, CL> Map<K, V, Tag, CL>
Sourcepub fn get<Q>(&self, key: Q) -> Option<(&V, Tag)>where
Q: Borrow<K>,
pub fn get<Q>(&self, key: Q) -> Option<(&V, Tag)>where
Q: Borrow<K>,
Returns a reference to the value and tag corresponding to the key.
Sourcepub fn contains<Q>(&self, key: Q) -> boolwhere
Q: Borrow<K>,
pub fn contains<Q>(&self, key: Q) -> boolwhere
Q: Borrow<K>,
Returns true if the map contains a value for the specified key.
Sourcepub fn insert(&mut self, key: K, value: V, tag: Tag) -> Option<(V, Tag)>
pub fn insert(&mut self, key: K, value: V, tag: Tag) -> Option<(V, Tag)>
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.
Sourcepub fn remove(&mut self, key: K, tag: Tag) -> Option<(V, Tag)>
pub fn remove(&mut self, key: K, tag: Tag) -> Option<(V, Tag)>
Remove a key from the map, returning the stored value and tag if the key was in the map.
Sourcepub fn iter(&self) -> impl Iterator<Item = (K, V, Tag)> + '_
pub fn iter(&self) -> impl Iterator<Item = (K, V, Tag)> + '_
An iterator visiting all key, value, tag tuples in arbitrary order.
Sourcepub fn register_iter(
&self,
) -> impl Iterator<Item = Register<(K, V), Tag, CL>> + '_
pub fn register_iter( &self, ) -> impl Iterator<Item = Register<(K, V), Tag, CL>> + '_
An iterator visiting all delta registers in arbitrary order.
Sourcepub fn merge_register(&mut self, delta: Register<(K, V), Tag, CL>, min_tag: Tag)
pub fn merge_register(&mut self, delta: Register<(K, V), Tag, CL>, min_tag: Tag)
Merge a delta Register into a map.
Remove deltas with a tag value less than min_tag will be ignored.