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
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
).
Implementations on Foreign Types
Implementors
The ToBytes
impl will truncate the value if it doesn’t fit.
Serializes the payload of the PDU to bytes.
The PDU header must be constructed using Link-Layer state (and Pdu::llid
).