Development Documentation (main branch) - For stable release docs, see docs.rs/eidetica

Decoder

Trait Decoder 

pub trait Decoder: Read {
Show 14 methods // Required methods fn reset_ds_cur_val(&mut self); fn read_ds_clock(&mut self) -> Result<u32, Error>; fn read_ds_len(&mut self) -> Result<u32, Error>; fn read_left_id(&mut self) -> Result<ID, Error>; fn read_right_id(&mut self) -> Result<ID, Error>; fn read_client(&mut self) -> Result<u64, Error>; fn read_info(&mut self) -> Result<u8, Error>; fn read_parent_info(&mut self) -> Result<bool, Error>; fn read_type_ref(&mut self) -> Result<u8, Error>; fn read_len(&mut self) -> Result<u32, Error>; fn read_any(&mut self) -> Result<Any, Error>; fn read_json(&mut self) -> Result<Any, Error>; fn read_key(&mut self) -> Result<Arc<str>, Error>; fn read_to_end(&mut self) -> Result<&[u8], Error>;
}
Expand description

Trait used by lib0 decoders. 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§

fn reset_ds_cur_val(&mut self)

Reset the value of current delete set state.

fn read_ds_clock(&mut self) -> Result<u32, Error>

Read next DeleteSet clock value.

fn read_ds_len(&mut self) -> Result<u32, Error>

Read the number of clients stored in encoded DeleteSet.

fn read_left_id(&mut self) -> Result<ID, Error>

Read left origin of a currently decoded [Block].

fn read_right_id(&mut self) -> Result<ID, Error>

Read right origin of a currently decoded [Block].

fn read_client(&mut self) -> Result<u64, Error>

Read currently decoded client identifier.

fn read_info(&mut self) -> Result<u8, Error>

Read info bit flags of a currently decoded [Block].

fn read_parent_info(&mut self) -> Result<bool, Error>

Read bit flags determining type of parent of a currently decoded [Block].

fn read_type_ref(&mut self) -> Result<u8, Error>

Read type ref info of a currently decoded [Block] parent.

fn read_len(&mut self) -> Result<u32, Error>

Read length parameter.

fn read_any(&mut self) -> Result<Any, Error>

Decode a JSON-like data type. It’s a complex type which is an extension of native JavaScript Object Notation.

fn read_json(&mut self) -> Result<Any, Error>

Decode an embedded JSON string into Any struct. It’s a complex type which is an extension of native JavaScript Object Notation.

fn read_key(&mut self) -> Result<Arc<str>, Error>

Read key string.

fn read_to_end(&mut self) -> Result<&[u8], Error>

Consume a rest of the decoded buffer data and return it without parsing.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl<'a> Decoder for DecoderV1<'a>

§

impl<'a> Decoder for DecoderV2<'a>