pub trait Writer {
// Required methods
fn serialization_mode(&self) -> SerializationMode;
fn protocol_version(&self) -> ProtocolVersion;
fn write_fixed_bytes<T: AsRef<[u8]>>(
&mut self,
bytes: T
) -> Result<(), Error>;
// Provided methods
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§
sourcefn serialization_mode(&self) -> SerializationMode
fn serialization_mode(&self) -> SerializationMode
The mode this serializer is writing in
sourcefn protocol_version(&self) -> ProtocolVersion
fn protocol_version(&self) -> ProtocolVersion
Protocol version for version specific serialization rules.
Provided Methods§
Object Safety§
This trait is not object safe.