pub trait Predicate: Clone {
    // Required method
    fn should_compress<B>(&self, response: &Response<B>) -> bool
       where B: Body;

    // Provided method
    fn and<Other>(self, other: Other) -> And<Self, Other>
       where Self: Sized,
             Other: Predicate { ... }
}
Available on crate features compression-br or compression-deflate or compression-gzip or compression-zstd only.
Expand description

Predicate used to determine if a response should be compressed or not.

Required Methods§

source

fn should_compress<B>(&self, response: &Response<B>) -> boolwhere B: Body,

Should this response be compressed or not?

Provided Methods§

source

fn and<Other>(self, other: Other) -> And<Self, Other>where Self: Sized, Other: Predicate,

Combine two predicates into one.

The resulting predicate enables compression if both inner predicates do.

Implementations on Foreign Types§

source§

impl<T> Predicate for Option<T>where T: Predicate,

source§

fn should_compress<B>(&self, response: &Response<B>) -> boolwhere B: Body,

Implementors§