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

Write

Trait Write 

pub trait Write: Sized {
Show 13 methods // Required method fn write_all(&mut self, buf: &[u8]); // Provided methods fn write_u8(&mut self, value: u8) { ... } fn write_u16(&mut self, num: u16) { ... } fn write_u32(&mut self, num: u32) { ... } fn write_u32_be(&mut self, num: u32) { ... } fn write_var<T>(&mut self, num: T) where T: VarInt { ... } fn write_var_signed<T>(&mut self, num: &Signed<T>) where T: SignedVarInt { ... } fn write_buf<B>(&mut self, buf: B) where B: AsRef<[u8]> { ... } fn write_string(&mut self, str: &str) { ... } fn write_f32(&mut self, num: f32) { ... } fn write_f64(&mut self, num: f64) { ... } fn write_i64(&mut self, num: i64) { ... } fn write_u64(&mut self, num: u64) { ... }
}

Required Methods§

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

Provided Methods§

fn write_u8(&mut self, value: u8)

fn write_u16(&mut self, num: u16)

Write an unsigned integer (16bit)

fn write_u32(&mut self, num: u32)

Write an unsigned integer (32bit)

fn write_u32_be(&mut self, num: u32)

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

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

Write a variable length integer or unsigned integer.

We don’t use zig-zag encoding because we want to keep the option open to use the same function for BigInt and 53bit integers.

We use the 7th bit instead for signaling that this is a negative number.

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

Write a variable length integer or unsigned integer.

We don’t use zig-zag encoding because we want to keep the option open to use the same function for BigInt and 53bit integers.

We use the 7th bit instead for signaling that this is a negative number.

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

Write variable length buffer (binary content).

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

Write variable-length utf8 string

fn write_f32(&mut self, num: f32)

Write floating point number in 4 bytes

fn write_f64(&mut self, num: f64)

Write floating point number in 8 bytes

fn write_i64(&mut self, num: i64)

Write BigInt in 8 bytes in big endian order.

fn write_u64(&mut self, num: u64)

Write BigUInt in 8 bytes in big endian order.

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.

Implementations on Foreign Types§

§

impl Write for Vec<u8>

§

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

§

fn write_u8(&mut self, value: u8)

Implementors§