Skip to main content

Encoder

Trait Encoder 

Source
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§

Source

type Item

The type of items consumed by the Encoder

Source

type Error: Debug

The type of encoding errors.

Provided Methods§

Source

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

👎Deprecated since 1.2.0:

Implement .encodev() method.

Encodes a frame into the buffer provided.

Source

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

Encodes a frame into the buffer provided.

Implementations on Foreign Types§

Source§

impl<T> Encoder for Rc<T>
where T: Encoder,

Source§

type Item = <T as Encoder>::Item

Source§

type Error = <T as Encoder>::Error

Source§

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

👎Deprecated since 1.2.0:

Implement .encodev() method.

Source§

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

Implementors§