Trait BodyExt
trait BodyExt: http_body::Body
An extension trait for http_body::Body adding various combinators and adapters
Provided Methods
fn frame(self: &mut Self) -> Frame<'_, Self> where Self: UnpinReturns a future that resolves to the next
Frame, if any.fn map_frame<F, B>(self: Self, f: F) -> MapFrame<Self, F> where Self: Sized, F: FnMut(Frame<<Self as >::Data>) -> Frame<B>, B: BufMaps this body's frame to a different kind.
fn map_err<F, E>(self: Self, f: F) -> MapErr<Self, F> where Self: Sized, F: FnMut(<Self as >::Error) -> EMaps this body's error value to a different value.
fn boxed(self: Self) -> BoxBody<<Self as >::Data, <Self as >::Error> where Self: Sized + Send + Sync + 'staticTurn this body into a boxed trait object.
fn boxed_unsync(self: Self) -> UnsyncBoxBody<<Self as >::Data, <Self as >::Error> where Self: Sized + Send + 'staticTurn this body into a boxed trait object that is !Sync.
fn collect(self: Self) -> Collect<Self> where Self: SizedTurn this body into
Collectedbody which will collect all the DATA frames and trailers.fn with_trailers<F>(self: Self, trailers: F) -> WithTrailers<Self, F> where Self: Sized, F: Future<Output = Option<Result<HeaderMap, <Self as >::Error>>>Add trailers to the body.
The trailers will be sent when all previous frames have been sent and the
trailersfuture resolves.Example
use HeaderMap; use ; use Bytes; # asyncfn into_data_stream(self: Self) -> BodyDataStream<Self> where Self: SizedTurn this body into
BodyDataStream.
Implementors
impl<T> BodyExt for Collected<B>impl<T> BodyExt for Either<L, R>impl<T> BodyExt for StreamBody<S>impl<T> BodyExt for BoxBody<D, E>impl<T> BodyExt for UnsyncBoxBody<D, E>impl<T> BodyExt for MapErr<B, F>impl<T> BodyExt for WithTrailers<T, F>impl<T> BodyExt for Full<D>impl<T> BodyExt for MapFrame<B, F>impl<T> BodyExt for BodyStream<B>impl<T> BodyExt for Limited<B>impl<T> BodyExt for Timpl<T> BodyExt for Empty<D>