Struct RequestDecompressionLayer
pub struct RequestDecompressionLayer { /* private fields */ }Expand description
Decompresses request bodies and calls its underlying service.
Transparently decompresses request bodies based on the Content-Encoding header.
When the encoding in the Content-Encoding header is not accepted an Unsupported Media Type
status code will be returned with the accepted encodings in the Accept-Encoding header.
Enabling pass-through of unaccepted encodings will not return an Unsupported Media Type. But
will call the underlying service with the unmodified request if the encoding is not supported.
This is disabled by default.
See the module docs for more details.
Implementations§
§impl RequestDecompressionLayer
impl RequestDecompressionLayer
pub fn new() -> RequestDecompressionLayer
pub fn new() -> RequestDecompressionLayer
Creates a new RequestDecompressionLayer.
pub fn gzip(self, enable: bool) -> RequestDecompressionLayer
pub fn gzip(self, enable: bool) -> RequestDecompressionLayer
Sets whether to support gzip encoding.
pub fn set_gzip(&mut self, enable: bool) -> &mut RequestDecompressionLayer
pub fn set_gzip(&mut self, enable: bool) -> &mut RequestDecompressionLayer
Sets whether to support gzip encoding.
pub fn deflate(self, enable: bool) -> RequestDecompressionLayer
pub fn deflate(self, enable: bool) -> RequestDecompressionLayer
Sets whether to support Deflate encoding.
pub fn set_deflate(&mut self, enable: bool) -> &mut RequestDecompressionLayer
pub fn set_deflate(&mut self, enable: bool) -> &mut RequestDecompressionLayer
Sets whether to support Deflate encoding.
pub fn br(self, enable: bool) -> RequestDecompressionLayer
pub fn br(self, enable: bool) -> RequestDecompressionLayer
Sets whether to support Brotli encoding.
pub fn set_br(&mut self, enable: bool) -> &mut RequestDecompressionLayer
pub fn set_br(&mut self, enable: bool) -> &mut RequestDecompressionLayer
Sets whether to support Brotli encoding.
pub fn zstd(self, enable: bool) -> RequestDecompressionLayer
pub fn zstd(self, enable: bool) -> RequestDecompressionLayer
Sets whether to support Zstd encoding.
pub fn set_zstd(&mut self, enable: bool) -> &mut RequestDecompressionLayer
pub fn set_zstd(&mut self, enable: bool) -> &mut RequestDecompressionLayer
Sets whether to support Zstd encoding.
pub fn pass_through_unaccepted(self, enable: bool) -> RequestDecompressionLayer
pub fn pass_through_unaccepted(self, enable: bool) -> RequestDecompressionLayer
Sets whether to pass through the request even when the encoding is not supported.
pub fn set_pass_through_unaccepted(
&mut self,
enable: bool,
) -> &mut RequestDecompressionLayer
pub fn set_pass_through_unaccepted( &mut self, enable: bool, ) -> &mut RequestDecompressionLayer
Sets whether to pass through the request even when the encoding is not supported.
Trait Implementations§
§impl Clone for RequestDecompressionLayer
impl Clone for RequestDecompressionLayer
§fn clone(&self) -> RequestDecompressionLayer
fn clone(&self) -> RequestDecompressionLayer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for RequestDecompressionLayer
impl Debug for RequestDecompressionLayer
§impl Default for RequestDecompressionLayer
impl Default for RequestDecompressionLayer
§fn default() -> RequestDecompressionLayer
fn default() -> RequestDecompressionLayer
§impl<S> Layer<S> for RequestDecompressionLayer
impl<S> Layer<S> for RequestDecompressionLayer
§type Service = RequestDecompression<S>
type Service = RequestDecompression<S>
§fn layer(&self, service: S) -> <RequestDecompressionLayer as Layer<S>>::Service
fn layer(&self, service: S) -> <RequestDecompressionLayer as Layer<S>>::Service
§fn into_layer(self, inner: S) -> Self::Service
fn into_layer(self, inner: S) -> Self::Service
layer but consuming self after the service was created. Read moreAuto Trait Implementations§
impl Freeze for RequestDecompressionLayer
impl RefUnwindSafe for RequestDecompressionLayer
impl Send for RequestDecompressionLayer
impl Sync for RequestDecompressionLayer
impl Unpin for RequestDecompressionLayer
impl UnwindSafe for RequestDecompressionLayer
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more