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|.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.