[−][src]Struct crdts::map::Map
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]
F: FnOnce(&V, AddCtx<A>) -> V::Op,
I: Into<K>,
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
fn apply(&mut self, op: Self::Op)
[src]
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(&self) -> 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]
K: Serialize,
V: Serialize,
A: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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]
K: Deserialize<'de>,
V: Deserialize<'de>,
A: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl<K, V, A> Send for Map<K, V, A> where
A: Send,
K: Send,
V: Send,
A: Send,
K: Send,
V: Send,
impl<K, V, A> Unpin for Map<K, V, A> where
A: Unpin,
K: Unpin,
V: Unpin,
A: Unpin,
K: Unpin,
V: Unpin,
impl<K, V, A> Sync for Map<K, V, A> where
A: Sync,
K: Sync,
V: Sync,
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,
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,
A: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
impl<T> Val for T where
T: PartialEq<T> + Clone + Debug,
[src]
T: PartialEq<T> + Clone + Debug,
impl<T> Val for T where
T: Clone + Debug,
[src]
T: Clone + Debug,
impl<A, T> Val<A> for T where
A: Actor,
T: Debug + Default + Clone + Causal<A> + CmRDT + CvRDT,
[src]
A: Actor,
T: Debug + Default + Clone + Causal<A> + CmRDT + CvRDT,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,