Trait Encoder

trait Encoder<Item>

Trait of helper objects to write out messages as bytes, for use with FramedWrite.

Associated Types

type Error: TraitBound { trait_: Path { path: "From", id: Id(37), args: Some(AngleBracketed { args: [Type(ResolvedPath(Path { path: "io::Error", id: Id(8), args: None }))], constraints: [] }) }, generic_params: [], modifier: None }

The type of encoding errors.

FramedWrite requires Encoders errors to implement From<io::Error> in the interest of letting it return Errors directly.

Required Methods

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

Encodes a frame into the buffer provided.

This method will encode item into the byte buffer provided by dst. The dst provided is an internal buffer of the FramedWrite instance and will be written out when possible.

Implementors