Struct aws_smithy_compression::body::compress::CompressedBody

source ·
pub struct CompressedBody<InnerBody, CompressionImpl> { /* private fields */ }
Expand description

A Body that may compress its data with a CompressRequest implementor.

Compression options may disable request compression for small data payload, or entirely. Additionally, some services may not support compression.

Implementations§

source§

impl CompressedBody<SdkBody, Box<dyn CompressRequest>>

source

pub fn into_compressed_sdk_body(self) -> Result<SdkBody, BoxError>

Available on crate feature http-body-0-4-x only.

Consumes this CompressedBody and returns an SdkBody containing the compressed data.

This requires that the inner SdkBody is in-memory (i.e. not streaming). Otherwise, an error is returned. If compression fails, an error is returned.

source§

impl<CR> CompressedBody<SdkBody, CR>

source

pub fn new(body: SdkBody, compress_request: CR) -> Self

Given an SdkBody and a Box<dyn CompressRequest>, create a new CompressedBody<SdkBody, CR>.

Trait Implementations§

source§

impl Body for CompressedBody<SdkBody, Box<dyn CompressRequest>>

Available on crate feature http-body-1-x only.
§

type Data = Bytes

Values yielded by the Body.
§

type Error = Box<dyn Error + Sync + Send>

The error type this Body might generate.
source§

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

Attempt to pull out the next data buffer of this stream.
source§

fn is_end_stream(&self) -> bool

Returns true when the end of stream has been reached. Read more
source§

fn size_hint(&self) -> SizeHint

Returns the bounds on the remaining length of the stream. Read more
source§

impl Body for CompressedBody<SdkBody, Box<dyn CompressRequest>>

Available on crate feature http-body-0-4-x only.
§

type Data = Bytes

Values yielded by the Body.
§

type Error = Box<dyn Error + Sync + Send>

The error type this Body might generate.
source§

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

Attempt to pull out the next data buffer of this stream.
source§

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

Poll for an optional single HeaderMap of trailers. Read more
source§

fn is_end_stream(&self) -> bool

Returns true when the end of stream has been reached. Read more
source§

fn size_hint(&self) -> SizeHint

Returns the bounds on the remaining length of the stream. Read more
source§

fn data(&mut self) -> Data<'_, Self>
where Self: Sized + Unpin,

Returns future that resolves to next data chunk, if any.
source§

fn trailers(&mut self) -> Trailers<'_, Self>
where Self: Sized + Unpin,

Returns future that resolves to trailers, if any.
source§

fn map_data<F, B>(self, f: F) -> MapData<Self, F>
where Self: Sized, F: FnMut(Self::Data) -> B, B: Buf,

Maps this body’s data value to a different value.
source§

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

Maps this body’s error value to a different value.
source§

fn collect(self) -> Collect<Self>
where Self: Sized,

Turn this body into Collected body which will collect all the DATA frames and trailers.
source§

fn boxed(self) -> BoxBody<Self::Data, Self::Error>
where Self: Sized + Send + Sync + 'static,

Turn this body into a boxed trait object.
source§

fn boxed_unsync(self) -> UnsyncBoxBody<Self::Data, Self::Error>
where Self: Sized + Send + 'static,

Turn this body into a boxed trait object that is !Sync.
source§

impl<'__pin, InnerBody, CompressionImpl> Unpin for CompressedBody<InnerBody, CompressionImpl>
where PinnedFieldsOf<__Origin<'__pin, InnerBody, CompressionImpl>>: Unpin,

Auto Trait Implementations§

§

impl<InnerBody, CompressionImpl> Freeze for CompressedBody<InnerBody, CompressionImpl>
where InnerBody: Freeze, CompressionImpl: Freeze,

§

impl<InnerBody, CompressionImpl> RefUnwindSafe for CompressedBody<InnerBody, CompressionImpl>
where InnerBody: RefUnwindSafe, CompressionImpl: RefUnwindSafe,

§

impl<InnerBody, CompressionImpl> Send for CompressedBody<InnerBody, CompressionImpl>
where InnerBody: Send, CompressionImpl: Send,

§

impl<InnerBody, CompressionImpl> Sync for CompressedBody<InnerBody, CompressionImpl>
where InnerBody: Sync, CompressionImpl: Sync,

§

impl<InnerBody, CompressionImpl> UnwindSafe for CompressedBody<InnerBody, CompressionImpl>
where InnerBody: UnwindSafe, CompressionImpl: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> BodyExt for T
where T: Body + ?Sized,

§

fn frame(&mut self) -> Frame<'_, Self>
where Self: Unpin,

Returns a future that resolves to the next Frame, if any.
§

fn map_frame<F, B>(self, f: F) -> MapFrame<Self, F>
where Self: Sized, F: FnMut(Frame<Self::Data>) -> Frame<B>, B: Buf,

Maps this body’s frame to a different kind.
§

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

Maps this body’s error value to a different value.
§

fn boxed(self) -> BoxBody<Self::Data, Self::Error>
where Self: Sized + Send + Sync + 'static,

Turn this body into a boxed trait object.
§

fn boxed_unsync(self) -> UnsyncBoxBody<Self::Data, Self::Error>
where Self: Sized + Send + 'static,

Turn this body into a boxed trait object that is !Sync.
§

fn collect(self) -> Collect<Self>
where Self: Sized,

Turn this body into [Collected] body which will collect all the DATA frames and trailers.
§

fn with_trailers<F>(self, trailers: F) -> WithTrailers<Self, F>
where Self: Sized, F: Future<Output = Option<Result<HeaderMap, Self::Error>>>,

Add trailers to the body. Read more
§

fn into_data_stream(self) -> BodyDataStream<Self>
where Self: Sized,

Turn this body into [BodyDataStream].
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more