pub trait Encoder {
type Item;
type Error: Debug;
// Required method
fn encode(
&self,
item: Self::Item,
dst: &mut BytesMut,
) -> Result<(), Self::Error>;
// Provided method
fn encode_vec(
&self,
item: Self::Item,
dst: &mut BytesVec,
) -> Result<(), Self::Error> { ... }
}
Expand description
Trait of helper objects to write out messages as bytes.