Trait rubble::bytes::ToBytes [−][src]
pub trait ToBytes { fn to_bytes(&self, writer: &mut ByteWriter<'_>) -> Result<(), Error>; }
Expand description
Trait for encoding a value into a byte buffer.
Required methods
fn to_bytes(&self, writer: &mut ByteWriter<'_>) -> Result<(), Error>
fn to_bytes(&self, writer: &mut ByteWriter<'_>) -> Result<(), Error>
Converts self
to bytes and writes them into writer
, advancing writer
to point past the
encoded value.
If writer
does not contain enough space, an error will be returned and the state of the
buffer is unspecified (eg. self
may be partially written into writer
).