MultipartWriteExt

Trait MultipartWriteExt 

Source
pub trait MultipartWriteExt<Part>: MultipartWrite<Part> {
Show 19 methods // Provided methods fn bootstrapped<S, F, Fut>( self, s: S, f: F, ) -> Bootstrapped<Self, S, F, Fut> where F: FnMut(&mut S) -> Fut, Fut: Future<Output = Result<Option<Self>, Self::Error>>, Self: Sized { ... } fn boxed<'a>( self, ) -> BoxMultipartWrite<'a, Part, Self::Ret, Self::Output, Self::Error> where Self: Sized + Send + 'a { ... } fn boxed_local<'a>( self, ) -> LocalBoxMultipartWrite<'a, Part, Self::Ret, Self::Output, Self::Error> where Self: Sized + 'a { ... } fn buffered( self, capacity: impl Into<Option<usize>>, ) -> Buffered<Self, Part> where Self: Sized { ... } fn complete(&mut self) -> Complete<'_, Self, Part> where Self: Unpin { ... } fn fanout<U>(self, other: U) -> Fanout<Self, U, Part> where Part: Clone, U: MultipartWrite<Part, Error = Self::Error>, Self: Sized { ... } fn feed(&mut self, part: Part) -> Feed<'_, Self, Part> where Self: Unpin { ... } fn flush(&mut self) -> Flush<'_, Self, Part> where Self: Unpin { ... } fn fold_ret<T, F>(self, id: T, f: F) -> FoldRet<Self, F, T> where F: FnMut(T, &Self::Ret) -> T, Self: Sized { ... } fn map<U, F>(self, f: F) -> Map<Self, F> where F: FnMut(Self::Output) -> U, Self: Sized { ... } fn map_err<E, F>(self, f: F) -> MapErr<Self, F> where F: FnMut(Self::Error) -> E, Self: Sized { ... } fn map_part<U, F>(self, f: F) -> MapPart<Self, F> where F: FnMut(U) -> Result<Part, Self::Error>, Self: MultipartWrite<Part> + Sized { ... } fn map_ret<U, F>(self, f: F) -> MapRet<Self, F> where F: FnMut(Self::Ret) -> U, Self: Sized { ... } fn poll_ready_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>> where Self: Unpin { ... } fn poll_flush_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>> where Self: Unpin { ... } fn poll_complete_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Self::Output, Self::Error>> where Self: Unpin { ... } fn send_part(&mut self, part: Part) -> SendPart<'_, Self, Part> where Self: Unpin { ... } fn then<U, F, Fut>(self, f: F) -> Then<Self, F, Fut> where F: FnMut(Self::Output) -> Fut, Fut: Future<Output = U>, Self: Sized { ... } fn with<U, Fut, F, E>(self, f: F) -> With<Self, Part, U, Fut, F> where F: FnMut(U) -> Fut, Fut: Future<Output = Result<Part, E>>, E: From<Self::Error>, Self: Sized { ... }
}
Expand description

An extension trait for MultipartWriters providing a variety of convenient combinator functions.

Provided Methods§

Source

fn bootstrapped<S, F, Fut>(self, s: S, f: F) -> Bootstrapped<Self, S, F, Fut>
where F: FnMut(&mut S) -> Fut, Fut: Future<Output = Result<Option<Self>, Self::Error>>, Self: Sized,

Returns a writer wrapping this one and having the property that a call to poll_ready will create Self if missing.

The value S and closure F determine how this is done. If a multipart write is not left in a reusable state after poll_complete, this adapter can be used to make a writer more than one-time-use where it otherwise would not be.

Source

fn boxed<'a>( self, ) -> BoxMultipartWrite<'a, Part, Self::Ret, Self::Output, Self::Error>
where Self: Sized + Send + 'a,

Wrap this writer in a Box, pinning it.

Source

fn boxed_local<'a>( self, ) -> LocalBoxMultipartWrite<'a, Part, Self::Ret, Self::Output, Self::Error>
where Self: Sized + 'a,

Wrap this writer in a Box, pinning it.

Similar to boxed but without the Send requirement.

Source

fn buffered(self, capacity: impl Into<Option<usize>>) -> Buffered<Self, Part>
where Self: Sized,

Adds a fixed size buffer to the current writer.

The resulting MultipartWrite will buffer up to capacity items when the underlying writer is not able to accept new parts.

Source

fn complete(&mut self) -> Complete<'_, Self, Part>
where Self: Unpin,

A future that runs this writer to completion, returning the associated output.

Source

fn fanout<U>(self, other: U) -> Fanout<Self, U, Part>
where Part: Clone, U: MultipartWrite<Part, Error = Self::Error>, Self: Sized,

Fanout the part to multiple writers.

This adapter clones each incoming part and forwards it to both writers.

Source

fn feed(&mut self, part: Part) -> Feed<'_, Self, Part>
where Self: Unpin,

A future that completes after the given part has been received by the writer.

Unlike write, the returned future does not flush the writer. It is the caller’s responsibility to ensure all pending items are processed, which can be done with flush or complete.

Source

fn flush(&mut self) -> Flush<'_, Self, Part>
where Self: Unpin,

A future that completes when the underlying writer has been flushed.

Source

fn fold_ret<T, F>(self, id: T, f: F) -> FoldRet<Self, F, T>
where F: FnMut(T, &Self::Ret) -> T, Self: Sized,

Accumulate this writer’s returned values, returning a new multipart writer that pairs the underlying writer’s output with the result of the accumulating function.

Source

fn map<U, F>(self, f: F) -> Map<Self, F>
where F: FnMut(Self::Output) -> U, Self: Sized,

Map this writer’s output type to a different type, returning a new multipart writer with the given output type.

Source

fn map_err<E, F>(self, f: F) -> MapErr<Self, F>
where F: FnMut(Self::Error) -> E, Self: Sized,

Map this writer’s error type to a different value, returning a new multipart writer with the given error type.

Source

fn map_part<U, F>(self, f: F) -> MapPart<Self, F>
where F: FnMut(U) -> Result<Part, Self::Error>, Self: MultipartWrite<Part> + Sized,

Pre-compose the underlying writer with a function that transforms a the input part type.

Source

fn map_ret<U, F>(self, f: F) -> MapRet<Self, F>
where F: FnMut(Self::Ret) -> U, Self: Sized,

Map this writer’s return type to a different value, returning a new multipart writer with the given return type.

Source

fn poll_ready_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
where Self: Unpin,

A convenience method for calling poll_ready on Unpin writer types.

Source

fn poll_flush_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
where Self: Unpin,

A convenience method for calling poll_flush on Unpin writer types.

Source

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

A convenience method for calling poll_complete on Unpin writer types.

Source

fn send_part(&mut self, part: Part) -> SendPart<'_, Self, Part>
where Self: Unpin,

A future that completes when a part has been fully processed into the writer, including flushing.

Source

fn then<U, F, Fut>(self, f: F) -> Then<Self, F, Fut>
where F: FnMut(Self::Output) -> Fut, Fut: Future<Output = U>, Self: Sized,

Chain a computation on the output of a writer.

Source

fn with<U, Fut, F, E>(self, f: F) -> With<Self, Part, U, Fut, F>
where F: FnMut(U) -> Fut, Fut: Future<Output = Result<Part, E>>, E: From<Self::Error>, Self: Sized,

Composes a function in front of the MultipartWrite.

This adapter produces a new MultipartWrite by passing each part through the given function f before sending it to self.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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