Expand description
Cache-Control header builder and parser (RFC 7234).
CacheControl represents the structured set of directives that can
appear in a Cache-Control HTTP header, with builder methods for the most
common request and response directives.
§Example
use api_bones::cache::CacheControl;
// Build a typical immutable public response.
let cc = CacheControl::new()
.public()
.max_age(31_536_000)
.immutable();
assert_eq!(cc.to_string(), "public, immutable, max-age=31536000");
// Parse a header value.
let cc: CacheControl = "no-store, no-cache".parse().unwrap();
assert!(cc.no_store);
assert!(cc.no_cache);Structs§
- Cache
Control - Structured
Cache-Controlheader (RFC 7234 §5.2). - Parse
Cache Control Error - Error returned when parsing a
Cache-Controlheader fails.