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: VarInt>(&mut self, num: T) { ... }
fn write_var_signed<T: SignedVarInt>(&mut self, num: &Signed<T>) { ... }
fn write_buf<B: AsRef<[u8]>>(&mut self, buf: B) { ... }
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§
Provided Methods§
fn write_u8(&mut self, value: u8)
sourcefn write_u32_be(&mut self, num: u32)
fn write_u32_be(&mut self, num: u32)
Write an unsigned integer (32bit) in big endian order (most significant byte first)
sourcefn write_var<T: VarInt>(&mut self, num: T)
fn write_var<T: VarInt>(&mut self, num: T)
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.
sourcefn write_var_signed<T: SignedVarInt>(&mut self, num: &Signed<T>)
fn write_var_signed<T: SignedVarInt>(&mut self, num: &Signed<T>)
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.
sourcefn write_string(&mut self, str: &str)
fn write_string(&mut self, str: &str)
Write variable-length utf8 string
Object Safety§
This trait is not object safe.