1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! Request predicates for cache eligibility.
//!
//! These predicates evaluate incoming HTTP requests to determine if a cache
//! lookup should be attempted.
//!
//! # Examples
//!
//! Cache only GET and HEAD requests:
//!
//! ```
//! use hitbox_http::predicates::request::Method;
//!
//! # use bytes::Bytes;
//! # use http_body_util::Empty;
//! # use hitbox::Neutral;
//! # use hitbox_http::CacheableHttpRequest;
//! # type Subject = CacheableHttpRequest<Empty<Bytes>>;
//! // Single method
//! let predicate = Method::new(http::Method::GET).unwrap();
//! # let _: &Method<Neutral<Subject>> = &predicate;
//!
//! // Multiple methods
//! let predicate = Method::new_in(
//! Neutral::new(),
//! vec![http::Method::GET, http::Method::HEAD],
//! );
//! # let _: &Method<Neutral<Subject>> = &predicate;
//! ```
//!
//! Skip cache for requests with `Cache-Control: no-cache`:
//!
//! ```
//! use hitbox::predicate::PredicateExt;
//! use hitbox_http::predicates::header::{Header, Operation};
//!
//! # use bytes::Bytes;
//! # use http_body_util::Empty;
//! # use hitbox::Neutral;
//! # use hitbox_http::CacheableHttpRequest;
//! # type Subject = CacheableHttpRequest<Empty<Bytes>>;
//! let predicate = Header::new(Operation::Contains(
//! http::header::CACHE_CONTROL,
//! "no-cache".to_string(),
//! ));
//! # let _: &Header<Neutral<Subject>> = &predicate;
//! let predicate = predicate.not();
//! ```
/// HTTP method predicates for cache eligibility.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;