Struct yrs::types::map::Map [−][src]
pub struct Map(_);
Expand description
Collection used to store key-value entries in an unordered manner. Keys are always represented as UTF-8 strings. Values can be any value type supported by Yrs: JSON-like primitives as well as shared data types.
In terms of conflict resolution, Map uses logical last-write-wins principle, meaning the past updates are automatically overridden and discarded by newer ones, while concurrent updates made by different peers are resolved into a single value using document id seniority to establish order.
Implementations
Converts all entries of a current map into JSON-like object representation.
Returns a number of entries stored within current map.
Returns an iterator that enables to traverse over all keys of entries stored within current map. These keys are not ordered.
Returns an iterator that enables to traverse over all values stored within current map.
Returns an iterator that enables to traverse over all entries - tuple of key-value pairs - stored within current map.
Inserts a new value
under given key
into current map. Returns a value stored previously
under the same key (if any existed).
Removes a stored within current map under a given key
. Returns that value or None
if
no entry with a given key
was present in current map.
Returns a value stored under a given key
within current map, or None
if no entry
with such key
existed.
Checks if an entry with given key
can be found within current map.
Clears the contents of current map, effectively removing all of its entries.
Subscribes a given callback to be triggered whenever current map is changed. A callback is triggered whenever a transaction gets committed. This function does not trigger if changes have been observed by nested shared collections.
All map changes can be tracked by using Event::keys method.
Returns an Observer which, when dropped, will unsubscribe current callback.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Map
impl !UnwindSafe for Map
Blanket Implementations
Mutably borrows from an owned value. Read more