rama::http::layer::compression::predicate

Trait Predicate

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 { ... }
}
Expand description

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

Required Methods§

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

Should this response be compressed or not?

Provided Methods§

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

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

§

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

Implementors§

§

impl Predicate for DefaultPredicate

§

impl Predicate for NotForContentType

§

impl Predicate for SizeAbove

§

impl<F> Predicate for F

§

impl<Lhs, Rhs> Predicate for And<Lhs, Rhs>
where Lhs: Predicate, Rhs: Predicate,