Crate loro_rle

Crate loro_rle 

Source
Expand description

Run length encoding library.

There are many mergeable types. By merging them together we can get a more compact representation of the data. For example, in many cases, [0..5, 5..10] can be merged into 0..10.

§RleVec

RleVec is a vector that can be compressed using run-length encoding.

A T value may be merged with its neighbors. When we push new element, the new value may be merged with the last element in the array. Each value has a length, so there are two types of indexes:

  1. (merged) It refers to the index of the merged element.
  2. (atom) The index of substantial elements. It refers to the index of the atom element.

By default, we use atom index in RleVec.

  • len() returns the number of atom elements in the array.
  • get(index) returns the atom element at the index.
  • slice(from, to) returns a slice of atom elements from the index from to the index to.

Modules§

rle_impl

Structs§

RleVec
RleVec is a vector that can be compressed using run-length encoding.
RleVecWithLen
SearchResult
Slice
SliceIterator

Traits§

HasIndex
HasLength
Mergable
Rle
RleCollection
RlePush
Sliceable
NOTE: Sliceable implementation should be coherent with Mergable:
ZeroElement

Functions§

slice_vec_by