[−][src]Trait grin_core::ser::Writer
Implementations defined how different numbers and binary structures are written to an underlying stream or container (depending on implementation).
Required methods
fn serialization_mode(&self) -> SerializationMode
The mode this serializer is writing in
fn protocol_version(&self) -> ProtocolVersion
Protocol version for version specific serialization rules.
fn write_fixed_bytes<T: AsFixedBytes>(&mut self, fixed: &T) -> Result<(), Error>
Writes a fixed number of bytes from something that can turn itself into
a &[u8]
. The reader is expected to know the actual length on read.
Provided methods
fn write_u8(&mut self, n: u8) -> Result<(), Error>
Writes a u8 as bytes
fn write_u16(&mut self, n: u16) -> Result<(), Error>
Writes a u16 as bytes
fn write_u32(&mut self, n: u32) -> Result<(), Error>
Writes a u32 as bytes
fn write_i32(&mut self, n: i32) -> Result<(), Error>
Writes a u32 as bytes
fn write_u64(&mut self, n: u64) -> Result<(), Error>
Writes a u64 as bytes
fn write_i64(&mut self, n: i64) -> Result<(), Error>
Writes a i64 as bytes
fn write_bytes<T: AsFixedBytes>(&mut self, bytes: &T) -> Result<(), Error>
Writes a variable number of bytes. The length is encoded as a 64-bit prefix.