pub trait MultipartWrite<Part> {
type Ret;
type Output;
type Error;
// Required methods
fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>;
fn start_send(
self: Pin<&mut Self>,
part: Part,
) -> Result<Self::Ret, Self::Error>;
fn poll_flush(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>;
fn poll_complete(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Self::Output, Self::Error>>;
}Expand description
MultipartWrite is a Sink-like interface for asynchronously writing an
object in parts.
Required Associated Types§
Required Methods§
Sourcefn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Attempts to prepare the MultipartWrite to receive a new part.
This method must be called and return Poll::Ready before each call to
start_send, indicating that the underlying writer is ready to have
another part written to it.
This method returns Poll::Pending when the object being prepared cannot
accept another part.
In most cases, if the writer encounters an error, it will be permanently unable to write more parts.
Sourcefn start_send(
self: Pin<&mut Self>,
part: Part,
) -> Result<Self::Ret, Self::Error>
fn start_send( self: Pin<&mut Self>, part: Part, ) -> Result<Self::Ret, Self::Error>
Begin the process of writing a part to this writer, returning the associated type confirming this was done successfully.
Like Sink, this should be preceded by a call to poll_ready that
returns Poll::Ready to ensure that the MultipartWrite is ready to
receive a new part.
§Errors
Errors returned by this method are implementation-specific, but it is
always an error to call start_send when poll_ready would return
Poll::Pending.
In most cases, if the writer encounters an error, it will be permanently unable to write more parts.
Sourcefn poll_flush(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Flush any remaining output from the writer.
Returns Poll::Ready when no buffered, unwritten parts remain and
Poll::Pending if there is more work left to do.
In most cases, if the writer encounters an error, it will be permanently unable to write more parts.
Sourcefn poll_complete(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Self::Output, Self::Error>>
fn poll_complete( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Self::Output, Self::Error>>
Complete this writer, returning the output.
This method returns Poll::Pending until no buffered, unwritten parts
remain and the complete output object is available.
In most cases, if the writer encounters an error, it will be permanently unable to write more parts.
Implementations on Foreign Types§
Source§impl<P, Part> MultipartWrite<Part> for Pin<P>
impl<P, Part> MultipartWrite<Part> for Pin<P>
type Ret = <<P as Deref>::Target as MultipartWrite<Part>>::Ret
type Output = <<P as Deref>::Target as MultipartWrite<Part>>::Output
type Error = <<P as Deref>::Target as MultipartWrite<Part>>::Error
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
fn start_send( self: Pin<&mut Self>, part: Part, ) -> Result<Self::Ret, Self::Error>
fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
fn poll_complete( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Self::Output, Self::Error>>
Source§impl<T> MultipartWrite<T> for VecDeque<T>
impl<T> MultipartWrite<T> for VecDeque<T>
type Ret = ()
type Output = VecDeque<T>
type Error = Infallible
fn poll_ready( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
fn start_send(self: Pin<&mut Self>, part: T) -> Result<Self::Ret, Self::Error>
fn poll_flush( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
fn poll_complete( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<Self::Output, Self::Error>>
Source§impl<T> MultipartWrite<T> for Vec<T>
impl<T> MultipartWrite<T> for Vec<T>
type Ret = ()
type Output = Vec<T>
type Error = Infallible
fn poll_ready( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
fn start_send(self: Pin<&mut Self>, part: T) -> Result<Self::Ret, Self::Error>
fn poll_flush( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
fn poll_complete( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<Self::Output, Self::Error>>
Source§impl<W: ?Sized + MultipartWrite<Part> + Unpin, Part> MultipartWrite<Part> for &mut W
impl<W: ?Sized + MultipartWrite<Part> + Unpin, Part> MultipartWrite<Part> for &mut W
type Ret = <W as MultipartWrite<Part>>::Ret
type Output = <W as MultipartWrite<Part>>::Output
type Error = <W as MultipartWrite<Part>>::Error
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
fn start_send( self: Pin<&mut Self>, part: Part, ) -> Result<Self::Ret, Self::Error>
fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
fn poll_complete( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Self::Output, Self::Error>>
Implementors§
Source§impl<Item, Wr, F> MultipartWrite<Item> for Fuse<Wr, F>
impl<Item, Wr, F> MultipartWrite<Item> for Fuse<Wr, F>
Source§impl<T, A> MultipartWrite<A> for Extend<T, A>where
T: Extend<A>,
impl<T, A> MultipartWrite<A> for Extend<T, A>where
T: Extend<A>,
Source§impl<T, Wr, U, Part> MultipartWrite<T> for Lift<Wr, U, Part>
impl<T, Wr, U, Part> MultipartWrite<T> for Lift<Wr, U, Part>
type Ret = <U as MultipartWrite<T>>::Ret
type Error = <Wr as MultipartWrite<Part>>::Error
type Output = <Wr as MultipartWrite<Part>>::Output
Source§impl<U, E, Wr, Part, Fut, F> MultipartWrite<U> for With<Wr, Part, Fut, F>
impl<U, E, Wr, Part, Fut, F> MultipartWrite<U> for With<Wr, Part, Fut, F>
Source§impl<U, Wr, F, Part> MultipartWrite<Part> for MapOk<Wr, F>
impl<U, Wr, F, Part> MultipartWrite<Part> for MapOk<Wr, F>
Source§impl<U, Wr, F, Part> MultipartWrite<Part> for MapRet<Wr, F>
impl<U, Wr, F, Part> MultipartWrite<Part> for MapRet<Wr, F>
Source§impl<W: Write + Default> MultipartWrite<&[u8]> for MultiIoWriter<W>
impl<W: Write + Default> MultipartWrite<&[u8]> for MultiIoWriter<W>
Source§impl<W: AsyncWrite + Default + Unpin> MultipartWrite<&[u8]> for MultiAsyncWriter<W>
Available on crate feature tokio only.
impl<W: AsyncWrite + Default + Unpin> MultipartWrite<&[u8]> for MultiAsyncWriter<W>
tokio only.