pub trait Encode<V>: Sized {
// Required method
fn encode<W: BufMut>(
&self,
w: &mut W,
version: V,
) -> Result<(), EncodeError>;
// Provided method
fn encode_bytes(&self, v: V) -> Result<Bytes, EncodeError> { ... }
}Expand description
Write the value to the buffer using the given version.
Required Methods§
Provided Methods§
Sourcefn encode_bytes(&self, v: V) -> Result<Bytes, EncodeError>
fn encode_bytes(&self, v: V) -> Result<Bytes, EncodeError>
Encode the value into a Bytes buffer.
NOTE: This will allocate.
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.