pub trait Encoder {
type Item;
type Error: Debug;
// Provided methods
fn encode(&self, _: Self::Item, _: &mut BytesMut) -> Result<(), Self::Error> { ... }
fn encodev(
&self,
item: Self::Item,
dst: &mut BytePages,
) -> Result<(), Self::Error> { ... }
}Expand description
Trait of helper objects to write out messages as bytes.
Required Associated Types§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T> Encoder for Rc<T>where
T: Encoder,
impl<T> Encoder for Rc<T>where
T: Encoder,
type Item = <T as Encoder>::Item
type Error = <T as Encoder>::Error
Source§fn encode(
&self,
item: Self::Item,
dst: &mut BytesMut,
) -> Result<(), Self::Error>
fn encode( &self, item: Self::Item, dst: &mut BytesMut, ) -> Result<(), Self::Error>
👎Deprecated since 1.2.0:
Implement .encodev() method.