pub struct MapMut<'a> { /* private fields */ }Expand description
Mutable reference to a Map CRDT.
Obtained through Transaction::root() or Transaction::get_map_mut().
Implementations§
Source§impl<'a> MapMut<'a>
impl<'a> MapMut<'a>
Sourcepub fn set(&mut self, key: &str, value: impl Into<PrimitiveValue>)
pub fn set(&mut self, key: &str, value: impl Into<PrimitiveValue>)
Set a key to a primitive value.
Accepts any type that implements Into<PrimitiveValue>:
bool, i64, i32, String, &str, or () for nil.
To create nested CRDTs, use create_map(), create_text(),
create_set(), or create_register() instead.
Sourcepub fn set_nil(&mut self, key: &str)
pub fn set_nil(&mut self, key: &str)
Set a key to nil (tombstone).
In CRDT semantics, this creates a tombstone - the key still exists but
has a nil value. Use get() to check if a value is nil, or use
get_conflicted() to see if there are concurrent non-nil values.
Note: contains_key() will still return true after this operation.
Sourcepub fn create_map(&mut self, key: &str) -> CrdtId
pub fn create_map(&mut self, key: &str) -> CrdtId
Create a nested Map at the given key.
Returns the CRDT ID of the new map, which can be used with
Transaction::map_by_id() to get a mutable reference.
Sourcepub fn create_text(&mut self, key: &str) -> CrdtId
pub fn create_text(&mut self, key: &str) -> CrdtId
Create a nested Text CRDT at the given key.
Returns the CRDT ID of the new text.
Sourcepub fn create_set(&mut self, key: &str) -> CrdtId
pub fn create_set(&mut self, key: &str) -> CrdtId
Create a nested Set CRDT at the given key.
Returns the CRDT ID of the new set.
Sourcepub fn create_register(&mut self, key: &str) -> CrdtId
pub fn create_register(&mut self, key: &str) -> CrdtId
Create a nested Register CRDT at the given key.
Returns the CRDT ID of the new register.