pub fn poll_recv<U>(
        &self,
        codec: &U,
        cx: &mut Context<'_>,
    ) -> Poll<Result<U::Item, RecvError<U>>>
    where
        U: Decoder,
    {
        match self.decode(codec) {
            Ok(Some(el)) => Poll::Ready(Ok(el)),
            Ok(None) => {
                let flags = self.flags();
                if flags.contains(Flags::IO_STOPPED) {
                    Poll::Ready(Err(RecvError::PeerGone(self.error())))
                } else if flags.contains(Flags::DSP_STOP) {
                    self.0 .0.remove_flags(Flags::DSP_STOP);
                    Poll::Ready(Err(RecvError::Stop))
                } else if flags.contains(Flags::DSP_KEEPALIVE) {
                    self.0 .0.remove_flags(Flags::DSP_KEEPALIVE);
                    Poll::Ready(Err(RecvError::KeepAlive))
                } else if flags.contains(Flags::WR_BACKPRESSURE) {
                    Poll::Ready(Err(RecvError::WriteBackpressure))
                } else {
                    match self.poll_read_ready(cx) {
                        Poll::Pending | Poll::Ready(Ok(Some(()))) => {
                            log::trace!("not enough data to decode next frame");
                            Poll::Pending
                        }
                        Poll::Ready(Err(e)) => {
                            Poll::Ready(Err(RecvError::PeerGone(Some(e))))
                        }
                        Poll::Ready(Ok(None)) => {
                            Poll::Ready(Err(RecvError::PeerGone(None)))
                        }
                    }
                }
            }
            Err(err) => Poll::Ready(Err(RecvError::Decoder(err))),
        }
    }
/// Decode codec item from incoming bytes stream.
///
/// Wake read task and request to read more data if data is not enough for decoding.
/// If error get returned this method does not register waker for later wake up action.
Decode codec item from incoming bytes stream.
Wake read task and request to read more data if data is not enough for decoding.
If error get returned this method does not register waker for later wake up action.
Decode codec item from incoming bytes stream . Wake read task and request to read more data if data is not enough for decoding . If error get returned this method does not register waker for later wake up action .
pub fn poll_recv<U>(
        &self,
        codec: &U,
        cx: &mut Context<'_>,
    ) -> Poll<Result<U::Item, RecvError<U>>>
    where
        U: Decoder,
    {
        match self.decode(codec) {
            Ok(Some(el)) => Poll::Ready(Ok(el)),
            Ok(None) => {
                let flags = self.flags();
                if flags.contains(Flags::IO_STOPPED) {
                    Poll::Ready(Err(RecvError::PeerGone(self.error())))
                } else if flags.contains(Flags::DSP_STOP) {
                    self.0 .0.remove_flags(Flags::DSP_STOP);
                    Poll::Ready(Err(RecvError::Stop))
                } else if flags.contains(Flags::DSP_KEEPALIVE) {
                    self.0 .0.remove_flags(Flags::DSP_KEEPALIVE);
                    Poll::Ready(Err(RecvError::KeepAlive))
                } else if flags.contains(Flags::WR_BACKPRESSURE) {
                    Poll::Ready(Err(RecvError::WriteBackpressure))
                } else {
                    match self.poll_read_ready(cx) {
                        Poll::Pending | Poll::Ready(Ok(Some(()))) => {
                            log::trace!("not enough data to decode next frame");
                            Poll::Pending
                        }
                        Poll::Ready(Err(e)) => {
                            Poll::Ready(Err(RecvError::PeerGone(Some(e))))
                        }
                        Poll::Ready(Ok(None)) => {
                            Poll::Ready(Err(RecvError::PeerGone(None)))
                        }
                    }
                }
            }
            Err(err) => Poll::Ready(Err(RecvError::Decoder(err))),
        }
    }
pub fn poll_recv < U > ( & self , codec : & U , cx : & mut Context < ' _ > , ) -> Poll < Result < U :: Item , RecvError < U > > > where U : Decoder , { match self . decode ( codec ) { Ok ( Some ( el ) ) => Poll :: Ready ( Ok ( el ) ) , Ok ( None ) => { let flags = self . flags ( ) ; if flags . contains ( Flags :: IO_STOPPED ) { Poll :: Ready ( Err ( RecvError :: PeerGone ( self . error ( ) ) ) ) } else if flags . contains ( Flags :: DSP_STOP ) { self . 0 . 0 . remove_flags ( Flags :: DSP_STOP ) ; Poll :: Ready ( Err ( RecvError :: Stop ) ) } else if flags . contains ( Flags :: DSP_KEEPALIVE ) { self . 0 . 0 . remove_flags ( Flags :: DSP_KEEPALIVE ) ; Poll :: Ready ( Err ( RecvError :: KeepAlive ) ) } else if flags . contains ( Flags :: WR_BACKPRESSURE ) { Poll :: Ready ( Err ( RecvError :: WriteBackpressure ) ) } else { match self . poll_read_ready ( cx ) { Poll :: Pending | Poll :: Ready ( Ok ( Some ( ( ) ) ) ) => { log :: trace ! ( " " ) ; Poll :: Pending } Poll :: Ready ( Err ( e ) ) => { Poll :: Ready ( Err ( RecvError :: PeerGone ( Some ( e ) ) ) ) } Poll :: Ready ( Ok ( None ) ) => { Poll :: Ready ( Err ( RecvError :: PeerGone ( None ) ) ) } } } } Err ( err ) => Poll :: Ready ( Err ( RecvError :: Decoder ( err ) ) ) , } }
Decode codec item from incoming bytes stream.
Decode codec item from incoming bytes stream .
&self
codec
&U
cx
&mut Context<'_>
&self
codec
&U
cx
&mut Context<'_>