Encoder

Trait Encoder 

Source
pub trait Encoder<Item> {
    type Error: From<Error>;

    // Required method
    fn encode(
        &mut self,
        item: Item,
        dst: &mut BytesMut,
    ) -> Result<(), Self::Error>;
}
Available on (crate features async_io or async_tokio) and crate feature async_framed only.

Required Associated Types§

Source

type Error: From<Error>

The type of encoding errors.

Required Methods§

Source

fn encode(&mut self, item: Item, dst: &mut BytesMut) -> Result<(), Self::Error>

Encodes a frame into the buffer provided.

Implementations on Foreign Types§

Source§

impl<T: Encoder<Item>, Item> Encoder<Item> for &mut T

Source§

type Error = <T as Encoder<Item>>::Error

Source§

fn encode(&mut self, item: Item, dst: &mut BytesMut) -> Result<(), Self::Error>

Implementors§