Struct tower_http::compression::CompressionLayer
source · [−]pub struct CompressionLayer<P = DefaultPredicate> { /* private fields */ }compression-br or compression-deflate or compression-gzip only.Expand description
Compress response bodies of the underlying service.
This uses the Accept-Encoding header to pick an appropriate encoding and adds the
Content-Encoding header to responses.
See the module docs for more details.
Implementations
Create a new CompressionLayer
This is supported on crate feature compression-gzip only.
compression-gzip only.Sets whether to enable the gzip encoding.
This is supported on crate feature compression-deflate only.
compression-deflate only.Sets whether to enable the Deflate encoding.
This is supported on crate feature compression-br only.
compression-br only.Sets whether to enable the Brotli encoding.
Disables the gzip encoding.
This method is available even if the gzip crate feature is disabled.
Disables the Deflate encoding.
This method is available even if the deflate crate feature is disabled.
Disables the Brotli encoding.
This method is available even if the br crate feature is disabled.
Replace the current compression predicate.
See Compression::compress_when for more details.
Trait Implementations
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl<P> RefUnwindSafe for CompressionLayer<P> where
P: RefUnwindSafe,
impl<P> Send for CompressionLayer<P> where
P: Send,
impl<P> Sync for CompressionLayer<P> where
P: Sync,
impl<P> Unpin for CompressionLayer<P> where
P: Unpin,
impl<P> UnwindSafe for CompressionLayer<P> where
P: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
follow-redirect only.Create a new Policy that returns Action::Follow only if self and other return
Action::Follow. Read more
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more