pub fn poll_flush(&self, cx: &mut Context<'_>, full: bool) -> Poll<io::Result<()>> {
        let flags = self.flags();

        if flags.contains(Flags::IO_STOPPED) {
            Poll::Ready(self.error().map(Err).unwrap_or(Ok(())))
        } else {
            let len = self
                .0
                 .0
                .with_write_buf(|buf| buf.as_ref().map(|b| b.len()).unwrap_or(0));

            if len > 0 {
                if full {
                    self.0 .0.insert_flags(Flags::WR_WAIT);
                    self.0 .0.dispatch_task.register(cx.waker());
                    return Poll::Pending;
                } else if len >= self.0.memory_pool().write_params_high() << 1 {
                    self.0 .0.insert_flags(Flags::WR_BACKPRESSURE);
                    self.0 .0.dispatch_task.register(cx.waker());
                    return Poll::Pending;
                }
            }
            self.0
                 .0
                .remove_flags(Flags::WR_WAIT | Flags::WR_BACKPRESSURE);
            Poll::Ready(Ok(()))
        }
    }
/// Wake write task and instruct to flush data.
///
/// If `full` is true then wake up dispatcher when all data is flushed
/// otherwise wake up when size of write buffer is lower than
/// buffer max size.
Wake write task and instruct to flush data.
If `full` is true then wake up dispatcher when all data is flushed
otherwise wake up when size of write buffer is lower than
buffer max size.
Wake write task and instruct to flush data . If ` full ` is true then wake up dispatcher when all data is flushed otherwise wake up when size of write buffer is lower than buffer max size .
pub fn poll_flush(&self, cx: &mut Context<'_>, full: bool) -> Poll<io::Result<()>> {
        let flags = self.flags();
        if flags.contains(Flags::IO_STOPPED) {
            Poll::Ready(self.error().map(Err).unwrap_or(Ok(())))
        } else {
            let len = self
                .0
                 .0
                .with_write_buf(|buf| buf.as_ref().map(|b| b.len()).unwrap_or(0));
            if len > 0 {
                if full {
                    self.0 .0.insert_flags(Flags::WR_WAIT);
                    self.0 .0.dispatch_task.register(cx.waker());
                    return Poll::Pending;
                } else if len >= self.0.memory_pool().write_params_high() << 1 {
                    self.0 .0.insert_flags(Flags::WR_BACKPRESSURE);
                    self.0 .0.dispatch_task.register(cx.waker());
                    return Poll::Pending;
                }
            }
            self.0
                 .0
                .remove_flags(Flags::WR_WAIT | Flags::WR_BACKPRESSURE);
            Poll::Ready(Ok(()))
        }
    }
pub fn poll_flush ( & self , cx : & mut Context < ' _ > , full : bool ) -> Poll < io :: Result < ( ) > > { let flags = self . flags ( ) ; if flags . contains ( Flags :: IO_STOPPED ) { Poll :: Ready ( self . error ( ) . map ( Err ) . unwrap_or ( Ok ( ( ) ) ) ) } else { let len = self . 0 . 0 . with_write_buf ( | buf | buf . as_ref ( ) . map ( | b | b . len ( ) ) . unwrap_or ( 0 ) ) ; if len > 0 { if full { self . 0 . 0 . insert_flags ( Flags :: WR_WAIT ) ; self . 0 . 0 . dispatch_task . register ( cx . waker ( ) ) ; return Poll :: Pending ; } else if len >= self . 0 . memory_pool ( ) . write_params_high ( ) << 1 { self . 0 . 0 . insert_flags ( Flags :: WR_BACKPRESSURE ) ; self . 0 . 0 . dispatch_task . register ( cx . waker ( ) ) ; return Poll :: Pending ; } } self . 0 . 0 . remove_flags ( Flags :: WR_WAIT | Flags :: WR_BACKPRESSURE ) ; Poll :: Ready ( Ok ( ( ) ) ) } }
Wake write task and instruct to flush data.
Wake write task and instruct to flush data .
&self
cx
&mut Context<'_>
full
bool
&self
cx
&mut Context<'_>
full
bool