Skip to main content

MultipartWrite

Trait MultipartWrite 

Source
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§

Source

type Recv

The type of value returned when sending a part to be written began successfully.

Source

type Output

The type of value assembled from the parts when they have all been written.

Source

type Error

The type of value returned when an operation fails.

Required Methods§

Source

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.

Source

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.

Source

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.

Source

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>
where P: DerefMut + Unpin, P::Target: MultipartWrite<Part>,

Source§

type Error = <<P as Deref>::Target as MultipartWrite<Part>>::Error

Source§

type Output = <<P as Deref>::Target as MultipartWrite<Part>>::Output

Source§

type Recv = <<P as Deref>::Target as MultipartWrite<Part>>::Recv

Source§

fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Source§

fn start_send( self: Pin<&mut Self>, part: Part, ) -> Result<Self::Recv, Self::Error>

Source§

fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Source§

fn poll_complete( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Self::Output, Self::Error>>

Source§

impl<T> MultipartWrite<T> for VecDeque<T>

Source§

type Error = Infallible

Source§

type Output = VecDeque<T>

Source§

type Recv = ()

Source§

fn poll_ready( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Source§

fn start_send(self: Pin<&mut Self>, part: T) -> Result<Self::Recv, Self::Error>

Source§

fn poll_flush( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Source§

fn poll_complete( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<Self::Output, Self::Error>>

Source§

impl<T> MultipartWrite<T> for Vec<T>

Source§

type Error = Infallible

Source§

type Output = Vec<T>

Source§

type Recv = ()

Source§

fn poll_ready( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Source§

fn start_send(self: Pin<&mut Self>, part: T) -> Result<Self::Recv, Self::Error>

Source§

fn poll_flush( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Source§

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

Source§

type Error = <W as MultipartWrite<Part>>::Error

Source§

type Output = <W as MultipartWrite<Part>>::Output

Source§

type Recv = <W as MultipartWrite<Part>>::Recv

Source§

fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Source§

fn start_send( self: Pin<&mut Self>, part: Part, ) -> Result<Self::Recv, Self::Error>

Source§

fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Source§

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>

Source§

type Error = <W as MultipartWrite<Part>>::Error

Source§

type Output = <W as MultipartWrite<Part>>::Output

Source§

type Recv = <W as MultipartWrite<Part>>::Recv

Source§

fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Source§

fn start_send( self: Pin<&mut Self>, part: Part, ) -> Result<Self::Recv, Self::Error>

Source§

fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Source§

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>
where T: Unpin + Default + Extend<A>,

Source§

impl<Part, Wr: MultipartWrite<Part>> MultipartWrite<Part> for Buffered<Wr, Part>

Source§

type Error = <Wr as MultipartWrite<Part>>::Error

Source§

type Output = <Wr as MultipartWrite<Part>>::Output

Source§

type Recv = Option<Vec<<Wr as MultipartWrite<Part>>::Recv>>

Source§

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.
Source§

impl<Wr1, Wr2, Part> MultipartWrite<Part> for Fanout<Wr1, Wr2, Part>
where Part: Clone, Wr1: MultipartWrite<Part>, Wr2: MultipartWrite<Part, Error = Wr1::Error>,

Source§

type Error = <Wr1 as MultipartWrite<Part>>::Error

Source§

type Output = (<Wr1 as MultipartWrite<Part>>::Output, <Wr2 as MultipartWrite<Part>>::Output)

Source§

type Recv = (<Wr1 as MultipartWrite<Part>>::Recv, <Wr2 as MultipartWrite<Part>>::Recv)

Source§

impl<Wr, Part, E, F> MultipartWrite<Part> for MapErr<Wr, Part, E, F>
where Wr: MultipartWrite<Part>, F: FnMut(Wr::Error) -> E,

Source§

type Error = E

Source§

type Output = <Wr as MultipartWrite<Part>>::Output

Source§

type Recv = <Wr as MultipartWrite<Part>>::Recv

Source§

impl<Wr, Part, F> MultipartWrite<Part> for FilterPart<Wr, Part, F>
where Wr: MultipartWrite<Part>, F: FnMut(&Part) -> bool,

Source§

type Error = <Wr as MultipartWrite<Part>>::Error

Source§

type Output = <Wr as MultipartWrite<Part>>::Output

Source§

type Recv = Option<<Wr as MultipartWrite<Part>>::Recv>

Source§

impl<Wr, Part, F> MultipartWrite<Part> for Fuse<Wr, Part, F>
where Wr: MultipartWrite<Part>, F: FnMut(&Wr::Output) -> bool,

Source§

type Error = <Wr as MultipartWrite<Part>>::Error

Source§

type Output = Option<<Wr as MultipartWrite<Part>>::Output>

Source§

type Recv = Option<<Wr as MultipartWrite<Part>>::Recv>

Source§

impl<Wr, Part, Fut, F> MultipartWrite<Part> for ForEachRecv<Wr, Part, Fut, F>
where Wr: MultipartWrite<Part>, Wr::Recv: Clone, F: FnMut(Wr::Recv) -> Fut, Fut: Future<Output = ()>,

Source§

type Error = <Wr as MultipartWrite<Part>>::Error

Source§

type Output = <Wr as MultipartWrite<Part>>::Output

Source§

type Recv = <Wr as MultipartWrite<Part>>::Recv

Source§

impl<Wr, Part, P, F> MultipartWrite<P> for FilterMapPart<Wr, Part, P, F>
where Wr: MultipartWrite<Part>, F: FnMut(P) -> Option<Part>,

Source§

type Error = <Wr as MultipartWrite<Part>>::Error

Source§

type Output = <Wr as MultipartWrite<Part>>::Output

Source§

type Recv = Option<<Wr as MultipartWrite<Part>>::Recv>

Source§

impl<Wr, Part, P, Fut, F> MultipartWrite<P> for ReadyPart<Wr, Part, P, Fut, F>
where Wr: MultipartWrite<Part>, F: FnMut(P) -> Fut, Fut: Future<Output = Result<Part, Wr::Error>>,

Source§

type Error = <Wr as MultipartWrite<Part>>::Error

Source§

type Output = <Wr as MultipartWrite<Part>>::Output

Source§

type Recv = ()

Source§

impl<Wr, Part, R, F> MultipartWrite<Part> for MapSent<Wr, Part, R, F>
where Wr: MultipartWrite<Part>, F: FnMut(Wr::Recv) -> R,

Source§

type Error = <Wr as MultipartWrite<Part>>::Error

Source§

type Output = <Wr as MultipartWrite<Part>>::Output

Source§

type Recv = R

Source§

impl<Wr, Part, T, F> MultipartWrite<Part> for MapOk<Wr, Part, T, F>
where Wr: MultipartWrite<Part>, F: FnMut(Wr::Output) -> T,

Source§

type Error = <Wr as MultipartWrite<Part>>::Error

Source§

type Output = T

Source§

type Recv = <Wr as MultipartWrite<Part>>::Recv

Source§

impl<Wr, Part, T, Fut, F> MultipartWrite<Part> for Then<Wr, Part, T, Fut, F>
where Wr: MultipartWrite<Part>, F: FnMut(Result<Wr::Output, Wr::Error>) -> Fut, Fut: Future<Output = Result<T, Wr::Error>>,

Source§

type Error = <Wr as MultipartWrite<Part>>::Error

Source§

type Output = T

Source§

type Recv = <Wr as MultipartWrite<Part>>::Recv

Source§

impl<Wr, T, F, Part> MultipartWrite<Part> for FoldSent<Wr, T, F, Part>
where Wr: MultipartWrite<Part>, F: FnMut(T, &Wr::Recv) -> T,

Source§

type Error = <Wr as MultipartWrite<Part>>::Error

Source§

type Output = (T, <Wr as MultipartWrite<Part>>::Output)

Source§

type Recv = <Wr as MultipartWrite<Part>>::Recv

Source§

impl<Wr, U, P, Part> MultipartWrite<P> for Lift<Wr, U, P, Part>
where U: MultipartWrite<P, Output = Part>, Wr: MultipartWrite<Part>, Wr::Error: From<U::Error>,

Source§

type Error = <Wr as MultipartWrite<Part>>::Error

Source§

type Output = <Wr as MultipartWrite<Part>>::Output

Source§

type Recv = <U as MultipartWrite<P>>::Recv