Trait conjure_http::client::AsyncWriteBody
source · pub trait AsyncWriteBody<W> {
// Required methods
fn write_body(
self: Pin<&mut Self>,
w: Pin<&mut W>,
) -> impl Future<Output = Result<(), Error>> + Send;
fn reset(self: Pin<&mut Self>) -> impl Future<Output = bool> + Send;
}
Expand description
A trait implemented by async streaming bodies.
§Examples
ⓘ
use conjure_error::Error;
use conjure_http::client::AsyncWriteBody;
use std::pin::Pin;
use tokio_io::{AsyncWrite, AsyncWriteExt};
pub struct SimpleBodyWriter;
impl<W> AsyncWriteBody<W> for SimpleBodyWriter
where
W: AsyncWrite + Send,
{
async fn write_body(self: Pin<&mut Self>, mut w: Pin<&mut W>) -> Result<(), Error> {
w.write_all(b"hello world").await.map_err(Error::internal_safe)
}
async fn reset(self: Pin<&mut Self>) -> bool {
true
}
}
Required Methods§
Object Safety§
This trait is not object safe.