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.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.