Struct DecompressionLayer
pub struct DecompressionLayer<M = DefaultDecompressionMatcher> { /* private fields */ }Expand description
Decompresses response bodies of the underlying service.
This adds the Accept-Encoding header to requests and transparently decompresses response
bodies based on the Content-Encoding header.
See the module docs for more details.
Implementations§
§impl DecompressionLayer
impl DecompressionLayer
pub fn new() -> DecompressionLayer
pub fn new() -> DecompressionLayer
Creates a new DecompressionLayer.
§impl<M> DecompressionLayer<M>
impl<M> DecompressionLayer<M>
pub fn with_insert_accept_encoding_header(
self,
insert: bool,
) -> DecompressionLayer<M>
pub fn with_insert_accept_encoding_header( self, insert: bool, ) -> DecompressionLayer<M>
Sets whether the layer inserts Accept-Encoding into requests when it is absent.
By default it is true.
pub fn set_insert_accept_encoding_header(
&mut self,
insert: bool,
) -> &mut DecompressionLayer<M>
pub fn set_insert_accept_encoding_header( &mut self, insert: bool, ) -> &mut DecompressionLayer<M>
Sets whether the layer inserts Accept-Encoding into requests when it is absent.
By default it is true.
pub fn with_matcher<T>(self, matcher: T) -> DecompressionLayer<T>
pub fn with_matcher<T>(self, matcher: T) -> DecompressionLayer<T>
Replaces the request/response decompression matcher.
The default matcher DefaultDecompressionMatcher
matches any response which has a response payload to be decompressed.
pub fn with_gzip(self, enable: bool) -> DecompressionLayer<M>
pub fn with_gzip(self, enable: bool) -> DecompressionLayer<M>
Sets whether to request the gzip encoding.
pub fn set_gzip(&mut self, enable: bool) -> &mut DecompressionLayer<M>
pub fn set_gzip(&mut self, enable: bool) -> &mut DecompressionLayer<M>
Sets whether to request the gzip encoding.
pub fn with_deflate(self, enable: bool) -> DecompressionLayer<M>
pub fn with_deflate(self, enable: bool) -> DecompressionLayer<M>
Sets whether to request the Deflate encoding.
pub fn set_deflate(&mut self, enable: bool) -> &mut DecompressionLayer<M>
pub fn set_deflate(&mut self, enable: bool) -> &mut DecompressionLayer<M>
Sets whether to request the Deflate encoding.
pub fn with_br(self, enable: bool) -> DecompressionLayer<M>
pub fn with_br(self, enable: bool) -> DecompressionLayer<M>
Sets whether to request the Brotli encoding.
pub fn set_br(&mut self, enable: bool) -> &mut DecompressionLayer<M>
pub fn set_br(&mut self, enable: bool) -> &mut DecompressionLayer<M>
Sets whether to request the Brotli encoding.
pub fn with_zstd(self, enable: bool) -> DecompressionLayer<M>
pub fn with_zstd(self, enable: bool) -> DecompressionLayer<M>
Sets whether to request the Zstd encoding.
pub fn set_zstd(&mut self, enable: bool) -> &mut DecompressionLayer<M>
pub fn set_zstd(&mut self, enable: bool) -> &mut DecompressionLayer<M>
Sets whether to request the Zstd encoding.
Trait Implementations§
§impl<M> Clone for DecompressionLayer<M>where
M: Clone,
impl<M> Clone for DecompressionLayer<M>where
M: Clone,
§fn clone(&self) -> DecompressionLayer<M>
fn clone(&self) -> DecompressionLayer<M>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<M> Debug for DecompressionLayer<M>where
M: Debug,
impl<M> Debug for DecompressionLayer<M>where
M: Debug,
§impl<M> Default for DecompressionLayer<M>where
M: Default,
impl<M> Default for DecompressionLayer<M>where
M: Default,
§fn default() -> DecompressionLayer<M>
fn default() -> DecompressionLayer<M>
§impl<S, M> Layer<S> for DecompressionLayer<M>where
M: Clone,
impl<S, M> Layer<S> for DecompressionLayer<M>where
M: Clone,
§type Service = Decompression<S, M>
type Service = Decompression<S, M>
§fn layer(&self, service: S) -> <DecompressionLayer<M> as Layer<S>>::Service
fn layer(&self, service: S) -> <DecompressionLayer<M> 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<M> Freeze for DecompressionLayer<M>where
M: Freeze,
impl<M> RefUnwindSafe for DecompressionLayer<M>where
M: RefUnwindSafe,
impl<M> Send for DecompressionLayer<M>where
M: Send,
impl<M> Sync for DecompressionLayer<M>where
M: Sync,
impl<M> Unpin for DecompressionLayer<M>where
M: Unpin,
impl<M> UnsafeUnpin for DecompressionLayer<M>where
M: UnsafeUnpin,
impl<M> UnwindSafe for DecompressionLayer<M>where
M: UnwindSafe,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§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