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:
- 1st version (implemented in Yrs) uses simple optimization techniques like var int encoding.
- 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§
Sourcefn reset_ds_cur_val(&mut self)
fn reset_ds_cur_val(&mut self)
Reset the value of current delete set state.
Sourcefn read_ds_len(&mut self) -> Result<u32, Error>
fn read_ds_len(&mut self) -> Result<u32, Error>
Read the number of clients stored in encoded DeleteSet.
Sourcefn read_left_id(&mut self) -> Result<ID, Error>
fn read_left_id(&mut self) -> Result<ID, Error>
Read left origin of a currently decoded [Block].
Sourcefn read_right_id(&mut self) -> Result<ID, Error>
fn read_right_id(&mut self) -> Result<ID, Error>
Read right origin of a currently decoded [Block].
Sourcefn read_client(&mut self) -> Result<u64, Error>
fn read_client(&mut self) -> Result<u64, Error>
Read currently decoded client identifier.
Sourcefn read_info(&mut self) -> Result<u8, Error>
fn read_info(&mut self) -> Result<u8, Error>
Read info bit flags of a currently decoded [Block].
Sourcefn read_parent_info(&mut self) -> Result<bool, Error>
fn read_parent_info(&mut self) -> Result<bool, Error>
Read bit flags determining type of parent of a currently decoded [Block].
Sourcefn read_type_ref(&mut self) -> Result<u8, Error>
fn read_type_ref(&mut self) -> Result<u8, Error>
Read type ref info of a currently decoded [Block] parent.
Sourcefn read_any(&mut self) -> Result<Any, Error>
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.
Sourcefn read_json(&mut self) -> Result<Any, Error>
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.
Sourcefn read_to_end(&mut self) -> Result<&[u8], Error>
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.