pub(crate) async fn send_body<Io, B>(
    body: B,
    mut framed: Pin<&mut Framed<Io, h1::ClientCodec>>,
) -> Result<(), SendRequestError>
where
    Io: ConnectionIo,
    B: MessageBody,
    B::Error: Into<Error>,
{
    actix_rt::pin!(body);

    let mut eof = false;
    while !eof {
        while !eof && !framed.as_ref().is_write_buf_full() {
            match poll_fn(|cx| body.as_mut().poll_next(cx)).await {
                Some(Ok(chunk)) => {
                    framed.as_mut().write(h1::Message::Chunk(Some(chunk)))?;
                }
                Some(Err(err)) => return Err(err.into().into()),
                None => {
                    eof = true;
                    framed.as_mut().write(h1::Message::Chunk(None))?;
                }
            }
        }

        if !framed.as_ref().is_write_buf_empty() {
            poll_fn(|cx| match framed.as_mut().flush(cx) {
                Poll::Ready(Ok(_)) => Poll::Ready(Ok(())),
                Poll::Ready(Err(err)) => Poll::Ready(Err(err)),
                Poll::Pending => {
                    if !framed.as_ref().is_write_buf_full() {
                        Poll::Ready(Ok(()))
                    } else {
                        Poll::Pending
                    }
                }
            })
            .await?;
        }
    }

    framed.get_mut().flush().await?;
    Ok(())
}
/// send request body to the peer
send request body to the peer
send request body to the peer
pub(crate) async fn send_body<Io, B>(
    body: B,
    mut framed: Pin<&mut Framed<Io, h1::ClientCodec>>,
) -> Result<(), SendRequestError>
where
    Io: ConnectionIo,
    B: MessageBody,
    B::Error: Into<Error>,
{
    actix_rt::pin!(body);
    let mut eof = false;
    while !eof {
        while !eof && !framed.as_ref().is_write_buf_full() {
            match poll_fn(|cx| body.as_mut().poll_next(cx)).await {
                Some(Ok(chunk)) => {
                    framed.as_mut().write(h1::Message::Chunk(Some(chunk)))?;
                }
                Some(Err(err)) => return Err(err.into().into()),
                None => {
                    eof = true;
                    framed.as_mut().write(h1::Message::Chunk(None))?;
                }
            }
        }
        if !framed.as_ref().is_write_buf_empty() {
            poll_fn(|cx| match framed.as_mut().flush(cx) {
                Poll::Ready(Ok(_)) => Poll::Ready(Ok(())),
                Poll::Ready(Err(err)) => Poll::Ready(Err(err)),
                Poll::Pending => {
                    if !framed.as_ref().is_write_buf_full() {
                        Poll::Ready(Ok(()))
                    } else {
                        Poll::Pending
                    }
                }
            })
            .await?;
        }
    }
    framed.get_mut().flush().await?;
    Ok(())
}
pub ( crate ) async fn send_body < Io , B > ( body : B , mut framed : Pin < & mut Framed < Io , h1 :: ClientCodec > > , ) -> Result < ( ) , SendRequestError > where Io : ConnectionIo , B : MessageBody , B :: Error : Into < Error > , { actix_rt :: pin ! ( body ) ; let mut eof = false ; while ! eof { while ! eof && ! framed . as_ref ( ) . is_write_buf_full ( ) { match poll_fn ( | cx | body . as_mut ( ) . poll_next ( cx ) ) . await { Some ( Ok ( chunk ) ) => { framed . as_mut ( ) . write ( h1 :: Message :: Chunk ( Some ( chunk ) ) ) ? ; } Some ( Err ( err ) ) => return Err ( err . into ( ) . into ( ) ) , None => { eof = true ; framed . as_mut ( ) . write ( h1 :: Message :: Chunk ( None ) ) ? ; } } } if ! framed . as_ref ( ) . is_write_buf_empty ( ) { poll_fn ( | cx | match framed . as_mut ( ) . flush ( cx ) { Poll :: Ready ( Ok ( _ ) ) => Poll :: Ready ( Ok ( ( ) ) ) , Poll :: Ready ( Err ( err ) ) => Poll :: Ready ( Err ( err ) ) , Poll :: Pending => { if ! framed . as_ref ( ) . is_write_buf_full ( ) { Poll :: Ready ( Ok ( ( ) ) ) } else { Poll :: Pending } } } ) . await ? ; } } framed . get_mut ( ) . flush ( ) . await ? ; Ok ( ( ) ) }
send request body to the peer
send request body to the peer
body
B
framed
Pin<&mut Framed<Io, h1::ClientCodec>>
body
B
framed
Pin<&mut Framed<Io, h1::ClientCodec>>