pub trait Encode<V>: Sized {
// Required method
fn encode<W: BufMut>(&self, w: &mut W, version: V);
// Provided method
fn encode_bytes(&self, v: V) -> Bytes { ... }
}Expand description
Write the value to the buffer using the given version.
Required Methods§
Sourcefn encode<W: BufMut>(&self, w: &mut W, version: V)
fn encode<W: BufMut>(&self, w: &mut W, version: V)
Encode the value to the given writer.
This will panic if the bytes::BufMut does not have enough capacity.
Provided Methods§
Sourcefn encode_bytes(&self, v: V) -> Bytes
fn encode_bytes(&self, v: V) -> Bytes
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.