[][src]Trait futures_codec::Encoder

pub trait Encoder {
    type Item;
    type Error: From<Error>;
    fn encode(
        &mut self,
        item: Self::Item,
        dst: &mut BytesMut
    ) -> Result<(), Self::Error>; }

Encoding of messages as bytes, for use with FramedWrite.

Associated Types

type Item

The type of items consumed by encode

type Error: From<Error>

The type of encoding errors.

Loading content...

Required methods

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

Encodes an item into the BytesMut provided by dst.

Loading content...

Implementors

impl Encoder for BytesCodec[src]

type Item = Bytes

type Error = Error

impl Encoder for LengthCodec[src]

type Item = Bytes

type Error = Error

impl Encoder for LinesCodec[src]

type Item = String

type Error = Error

impl<Enc, Dec> Encoder for CborCodec<Enc, Dec> where
    Dec: Deserialize<'de> + 'static,
    Enc: Serialize + 'static, 
[src]

Encoder impl encodes object streams to bytes

type Item = Enc

type Error = CborCodecError

impl<Enc, Dec> Encoder for JsonCodec<Enc, Dec> where
    Dec: Deserialize<'de> + 'static,
    Enc: Serialize + 'static, 
[src]

Encoder impl encodes object streams to bytes

type Item = Enc

type Error = JsonCodecError

Loading content...