Struct causal_length::map::Map [−][src]
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]
K: Key + Ord,
V: Value + Hash + Eq + Ord,
Tag: TagT,
CL: CausalLength,
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]
Q: Borrow<K>,
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]
Q: Borrow<K>,
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]
&self
) -> impl Iterator<Item = Register<(K, V), Tag, CL>> + '_
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]
K: Key + Ord,
V: Value + Hash + Eq + Ord,
Tag: TagT,
CL: CausalLength,
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]
K: Key + Ord,
V: Value + Hash + Eq + Ord,
Tag: TagT,
CL: CausalLength,
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]
K: Key + Ord,
V: Value + Hash + Eq + Ord,
Tag: TagT,
CL: CausalLength,
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]
K: Key + Ord + Deserialize<'de>,
V: Value + Hash + Ord + Deserialize<'de>,
Tag: TagT + Deserialize<'de>,
CL: CausalLength + Deserialize<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
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]
K: Key + Ord,
V: Value + Hash + Eq + Ord,
Tag: TagT,
CL: CausalLength,
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]
K: Key + Ord,
V: Value + Hash + Eq + Ord,
Tag: TagT,
CL: CausalLength,
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]
K: Key + Ord,
V: Value + Hash + Eq + Ord,
Tag: TagT,
CL: CausalLength,
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]
K: Key + Ord,
V: Value + Hash + Eq + Ord,
Tag: TagT,
CL: CausalLength,
fn eq(&self, other: &Map<K, V, Tag, CL>) -> bool
[src]
fn ne(&self, other: &Map<K, V, Tag, CL>) -> bool
[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]
K: Key + Ord + Serialize,
V: Value + Hash + Ord + Serialize,
Tag: TagT + Serialize,
CL: CausalLength + Serialize,
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]
K: Key + Ord,
V: Value + Hash + Eq + Ord,
Tag: TagT,
CL: CausalLength,
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]
K: Key + Ord,
V: Value + Hash + Eq + Ord,
Tag: TagT,
CL: CausalLength,
Auto Trait Implementations
impl<K, V, Tag, CL> RefUnwindSafe for Map<K, V, Tag, CL> where
CL: RefUnwindSafe,
K: RefUnwindSafe,
Tag: RefUnwindSafe,
V: RefUnwindSafe,
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,
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,
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,
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,
CL: UnwindSafe,
K: UnwindSafe,
Tag: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Value for T where
T: Clone + Eq,
[src]
T: Clone + Eq,