Trait ntex::codec::Decoder[][src]

pub trait Decoder {
    type Item;
    type Error: Debug;
    fn decode(
        &self,
        src: &mut BytesMut
    ) -> Result<Option<Self::Item>, Self::Error>; fn decode_eof(
        &self,
        buf: &mut BytesMut
    ) -> Result<Option<Self::Item>, Self::Error> { ... } }
Expand description

Decoding of frames via buffers.

Associated Types

type Item[src]

The type of decoded frames.

type Error: Debug[src]

The type of unrecoverable frame decoding errors.

If an individual message is ill-formed but can be ignored without interfering with the processing of future messages, it may be more useful to report the failure as an Item.

Required methods

fn decode(&self, src: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error>[src]

Attempts to decode a frame from the provided buffer of bytes.

Provided methods

fn decode_eof(
    &self,
    buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
[src]

A default method available to be called when there are no more bytes available to be read from the underlying I/O.

This method defaults to calling decode and returns an error if Ok(None) is returned while there is unconsumed data in buf. Typically this doesn’t need to be implemented unless the framing protocol differs near the end of the stream.

Implementations on Foreign Types

impl<T> Decoder for Rc<T> where
    T: Decoder
[src]

type Item = <T as Decoder>::Item

type Error = <T as Decoder>::Error

pub fn decode(
    &self,
    src: &mut BytesMut
) -> Result<Option<<Rc<T> as Decoder>::Item>, <Rc<T> as Decoder>::Error>
[src]

pub fn decode_eof(
    &self,
    src: &mut BytesMut
) -> Result<Option<<Rc<T> as Decoder>::Item>, <Rc<T> as Decoder>::Error>
[src]

Implementors

impl Decoder for ClientCodec[src]

type Item = ResponseHead

type Error = ParseError

fn decode(&self, src: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error>[src]

impl Decoder for ClientPayloadCodec[src]

type Item = Option<Bytes>

type Error = PayloadError

fn decode(&self, src: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error>[src]

impl Decoder for ntex::http::h1::Codec[src]

type Item = (Request, PayloadType)

type Error = ParseError

fn decode(&self, src: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error>[src]

impl Decoder for PayloadDecoder[src]

type Item = PayloadItem

type Error = ParseError

fn decode(&self, src: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error>[src]

impl Decoder for ntex::ws::Codec[src]

type Item = Frame

type Error = ProtocolError

fn decode(&self, src: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error>[src]

impl Decoder for BytesCodec[src]

type Item = BytesMut

type Error = Error

pub fn decode(
    &self,
    src: &mut BytesMut
) -> Result<Option<<BytesCodec as Decoder>::Item>, <BytesCodec as Decoder>::Error>
[src]