EncoderV1

Struct EncoderV1 

Source
pub struct EncoderV1 { /* private fields */ }

Implementations§

Source§

impl EncoderV1

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl Encoder for EncoderV1

Source§

fn to_vec(self) -> Vec<u8>

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

fn reset_ds_cur_val(&mut self)

Reset the state of currently encoded DeleteSet.
Source§

fn write_ds_clock(&mut self, clock: u32)

Write a clock value of currently encoded DeleteSet client.
Source§

fn write_ds_len(&mut self, len: u32)

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

fn write_left_id(&mut self, id: &ID)

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

fn write_right_id(&mut self, id: &ID)

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

fn write_client(&mut self, client: ClientID)

Write currently encoded client identifier.
Source§

fn write_info(&mut self, info: u8)

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.
Source§

fn write_parent_info(&mut self, is_y_key: bool)

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

fn write_type_ref(&mut self, info: u8)

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

fn write_len(&mut self, len: u32)

Write length parameter.
Source§

fn write_any(&mut self, any: &Any)

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

fn write_json(&mut self, any: &Any)

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

fn write_key(&mut self, key: &str)

Write a string key.
Source§

impl Write for EncoderV1

Source§

fn write_all(&mut self, buf: &[u8])

Source§

fn write_u8(&mut self, value: u8)

Source§

fn write_u16(&mut self, num: u16)

Write an unsigned integer (16bit)
Source§

fn write_u32(&mut self, num: u32)

Write an unsigned integer (32bit)
Source§

fn write_u32_be(&mut self, num: u32)

Write an unsigned integer (32bit) in big endian order (most significant byte first)
Source§

fn write_var<T: VarInt>(&mut self, num: T)

Write a variable length integer or unsigned integer. Read more
Source§

fn write_var_signed<T: SignedVarInt>(&mut self, num: &Signed<T>)

Write a variable length integer or unsigned integer. Read more
Source§

fn write_buf<B: AsRef<[u8]>>(&mut self, buf: B)

Write variable length buffer (binary content).
Source§

fn write_string(&mut self, str: &str)

Write variable-length utf8 string
Source§

fn write_f32(&mut self, num: f32)

Write floating point number in 4 bytes
Source§

fn write_f64(&mut self, num: f64)

Write floating point number in 8 bytes
Source§

fn write_i64(&mut self, num: i64)

Write BigInt in 8 bytes in big endian order.
Source§

fn write_u64(&mut self, num: u64)

Write BigUInt in 8 bytes in big endian order.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.