MultipartWrite

Trait MultipartWrite 

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

Source

type Ret

The type of value returned when writing the part began successfully.

Source

type Output

The type of value returned when all parts are 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.

In most cases, if the writer encounters an error, it will be permanently unable to write more parts.

Source

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.

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

Source

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

Source§

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

Source§

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

Source§

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

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::Ret, 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 Ret = ()

Source§

type Output = VecDeque<T>

Source§

type Error = Infallible

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::Ret, 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 Ret = ()

Source§

type Output = Vec<T>

Source§

type Error = Infallible

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::Ret, 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 Ret = <W as MultipartWrite<Part>>::Ret

Source§

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

Source§

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

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::Ret, 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<Item, Wr, F> MultipartWrite<Item> for Fuse<Wr, F>
where Wr: MultipartWrite<Item>, F: FnMut(&Wr::Output) -> bool,

Source§

type Ret = Option<<Wr as MultipartWrite<Item>>::Ret>

Source§

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

Source§

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

Source§

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>
where U: MultipartWrite<T, Output = Part>, Wr: MultipartWrite<Part>, Wr::Error: From<U::Error>,

Source§

type Ret = <U as MultipartWrite<T>>::Ret

Source§

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

Source§

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

Source§

impl<U, E, Wr, Part, Fut, F> MultipartWrite<U> for With<Wr, Part, Fut, F>
where Wr: MultipartWrite<Part>, F: FnMut(U) -> Fut, Fut: Future<Output = Result<Part, E>>, E: From<Wr::Error>,

Source§

type Ret = ()

Source§

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

Source§

type Error = E

Source§

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

Source§

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

Source§

type Output = U

Source§

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

Source§

impl<U, Wr, F, Part> MultipartWrite<Part> for MapRet<Wr, F>
where Wr: MultipartWrite<Part>, F: FnMut(Wr::Ret) -> U,

Source§

type Ret = U

Source§

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

Source§

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

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 Ret = (<Wr1 as MultipartWrite<Part>>::Ret, <Wr2 as MultipartWrite<Part>>::Ret)

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

type Error = E

Source§

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

Source§

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

Source§

type Output = T

Source§

type Error = E

Source§

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

Source§

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

Source§

type Output = T

Source§

type Error = E

Source§

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

Source§

type Ret = ()

Source§

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

Source§

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

Source§

impl<Wr, Part, E, Fut> MultipartWrite<Part> for Resolve<Fut, Wr>
where Fut: Future<Output = Result<Wr, E>>, Wr: MultipartWrite<Part, Error = E>,

Source§

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

Source§

type Error = E

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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