pub trait MultipartWrite<Part> {
type Recv;
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::Recv, 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 an 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.
§Errors
Errors returned by this method are entirely implementation-specific but could render the writer permanently unusable.
Sourcefn start_send(
self: Pin<&mut Self>,
part: Part,
) -> Result<Self::Recv, Self::Error>
fn start_send( self: Pin<&mut Self>, part: Part, ) -> Result<Self::Recv, Self::Error>
Begin the process of writing a part to this writer, returning the associated type confirming it was received successfully.
This method must 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 entirely implementation-specific but
could render the writer permanently unusable. However, it is always an
error to call start_send when poll_ready would return the value
Poll::Pending indicating that the writer was not available to have a
part written.
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 unwritten parts remain and Poll::Pending
if there is more work left to do.
§Errors
Errors returned by this method are entirely implementation-specific but could render the writer permanently unusable.
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 the write, returning the output assembled from the written parts.
This method returns Poll::Pending until no buffered, unwritten parts
remain and the complete output object is available.
§Errors
Errors returned by this method are entirely implementation-specific but could render the writer permanently unusable.
Implementations on Foreign Types§
Source§impl<P, Part> MultipartWrite<Part> for Pin<P>
impl<P, Part> MultipartWrite<Part> for Pin<P>
type Error = <<P as Deref>::Target as MultipartWrite<Part>>::Error
type Output = <<P as Deref>::Target as MultipartWrite<Part>>::Output
type Recv = <<P as Deref>::Target as MultipartWrite<Part>>::Recv
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::Recv, 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 Error = Infallible
type Output = VecDeque<T>
type Recv = ()
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::Recv, 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 Error = Infallible
type Output = Vec<T>
type Recv = ()
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::Recv, 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 Error = <W as MultipartWrite<Part>>::Error
type Output = <W as MultipartWrite<Part>>::Output
type Recv = <W as MultipartWrite<Part>>::Recv
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::Recv, 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 Box<W>
impl<W: ?Sized + MultipartWrite<Part> + Unpin, Part> MultipartWrite<Part> for Box<W>
type Error = <W as MultipartWrite<Part>>::Error
type Output = <W as MultipartWrite<Part>>::Output
type Recv = <W as MultipartWrite<Part>>::Recv
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::Recv, 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<A, T> MultipartWrite<A> for Extend<T>
impl<A, T> MultipartWrite<A> for Extend<T>
Source§impl<Part, Wr: MultipartWrite<Part>> MultipartWrite<Part> for Buffered<Wr, Part>
impl<Part, Wr: MultipartWrite<Part>> MultipartWrite<Part> for Buffered<Wr, Part>
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.