Trait yrs::updates::encoder::Encoder[][src]

pub trait Encoder: Write {
Show 13 methods fn to_vec(self) -> Vec<u8>;
fn reset_ds_cur_val(&mut self);
fn write_ds_clock(&mut self, clock: u32);
fn write_ds_len(&mut self, len: u32);
fn write_left_id(&mut self, id: &ID);
fn write_right_id(&mut self, id: &ID);
fn write_client(&mut self, client: u64);
fn write_info(&mut self, info: u8);
fn write_parent_info(&mut self, is_y_key: bool);
fn write_type_ref(&mut self, info: u8);
fn write_len(&mut self, len: u32);
fn write_any(&mut self, any: &Any);
fn write_key(&mut self, string: &str);
}
Expand description

Trait used by lib0 encoders. Natively lib0 encoding supports two versions:

  1. 1st version (implemented in Yrs) uses simple optimization techniques like var int encoding.
  2. 2nd version optimizes bigger batches of blocks by using run-length encoding.

Both of these define a common set of operations defined in this trait.

Required methods

Consume current encoder and return a binary with all data encoded so far.

Reset the state of currently encoded DeleteSet.

Write a clock value of currently encoded DeleteSet client.

Write a number of client entries used by currently encoded DeleteSet.

Write unique identifier of a currently encoded [Block]’s left origin.

Write unique identifier of a currently encoded [Block]’s right origin.

Write currently encoded client identifier.

Write currently encoded [Block]’s info flags. These contain information about which fields have been provided and which should be skipped during decoding process as well as a type of block currently encoded.

Write info flag about currently encoded [Block]’s parent. Is is another block or root type.

Writes type ref data of currently encoded [Block]’s parent.

Write length parameter.

Encode JSON-like data type. This is a complex structure which is an extension to JavaScript Object Notation with some extra cases.

Write a string key.

Implementors