Trait packet_encoding::Encodable
source · pub trait Encodable: Sized {
type Error;
// Required methods
fn encoded_len(&self) -> usize;
fn encode(&self, buf: &mut [u8]) -> Result<(), Self::Error>;
}
Expand description
An encodable type can write itself into a byte buffer.
Required Associated Types§
Required Methods§
sourcefn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the number of bytes necessary to encode |self|.
Object Safety§
This trait is not object safe.