pub trait Writer {
    fn serialization_mode(&self) -> SerializationMode;
fn protocol_version(&self) -> ProtocolVersion;
fn write_fixed_bytes<T: AsRef<[u8]>>(
        &mut self,
        bytes: T
    ) -> Result<(), Error>; fn write_u8(&mut self, n: u8) -> Result<(), Error> { ... }
fn write_u16(&mut self, n: u16) -> Result<(), Error> { ... }
fn write_u32(&mut self, n: u32) -> Result<(), Error> { ... }
fn write_i32(&mut self, n: i32) -> Result<(), Error> { ... }
fn write_u64(&mut self, n: u64) -> Result<(), Error> { ... }
fn write_i64(&mut self, n: i64) -> Result<(), Error> { ... }
fn write_bytes<T: AsRef<[u8]>>(&mut self, bytes: T) -> Result<(), Error> { ... }
fn write_empty_bytes(&mut self, length: usize) -> Result<(), Error> { ... } }
Expand description

Implementations defined how different numbers and binary structures are written to an underlying stream or container (depending on implementation).

Required methods

The mode this serializer is writing in

Protocol version for version specific serialization rules.

Writes a fixed number of bytes. The reader is expected to know the actual length on read.

Provided methods

Writes a u8 as bytes

Writes a u16 as bytes

Writes a u32 as bytes

Writes a u32 as bytes

Writes a u64 as bytes

Writes a i64 as bytes

Writes a variable number of bytes. The length is encoded as a 64-bit prefix.

Writes a fixed length of “empty” bytes.

Implementors