Type Definition yrs::Array[][src]

pub type Array = Array;
Expand description

A collection used to store data in an indexed sequence structure. This type is internally implemented as a double linked list, which may squash values inserted directly one after another into single list node upon transaction commit.

Reading a root-level type as an YArray means treating its sequence components as a list, where every countable element becomes an individual entity:

  • JSON-like primitives (booleans, numbers, strings, JSON maps, arrays etc.) are counted individually.
  • Text chunks inserted by YText data structure: each character becomes an element of an array.
  • Embedded and binary values: they count as a single element even though they correspond of multiple bytes.

Like all Yrs shared data types, YArray is resistant to the problem of interleaving (situation when elements inserted one after another may interleave with other peers concurrent inserts after merging all updates together). In case of Yrs conflict resolution is solved by using unique document id to determine correct and consistent ordering.