Skip to main content

Predicate

Trait Predicate 

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

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

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

Required Methods§

Source

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

Should this response be compressed or not?

The response is mutable so predicates can attach extensions used later during response-time compression negotiation.

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

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

Source§

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

Implementors§