#[non_exhaustive]pub struct ResponseDirectives {Show 16 fields
pub max_age: Option<u32>,
pub s_maxage: Option<u32>,
pub no_cache: bool,
pub no_store: bool,
pub private: bool,
pub public: bool,
pub must_revalidate: bool,
pub proxy_revalidate: bool,
pub must_understand: bool,
pub no_transform: bool,
pub immutable: bool,
pub stale_while_revalidate: Option<u32>,
pub stale_if_error: Option<u32>,
pub duplicates: bool,
pub invalid_values: bool,
pub unknown: u16,
}Expand description
The response directives (RFC 9111 section 5.2.2 and the extensions).
Unknown directives are counted in unknown and available raw through
parse. A directive given twice keeps its first value and sets
duplicates (RFC 9111 section 4.2.1); an argument that does not fit
(max-age=60s) leaves the field None and sets invalid_values: treat
such a response as stale. Conflicting directives (private, public) are
both reported.
§Examples
let cc = parse_net::response_cache_control(b"max-age=60, s-maxage=60s, immutable")?;
assert_eq!(cc.max_age, Some(60));
assert!(cc.immutable);
assert!(cc.s_maxage.is_none() && cc.invalid_values);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_age: Option<u32>max-age, saturating at 2147483648.
s_maxage: Option<u32>s-maxage.
no_cache: boolno-cache (with or without a field list).
no_store: boolno-store.
private: boolprivate (with or without a field list).
public: boolpublic.
must_revalidate: boolmust-revalidate.
proxy_revalidate: boolproxy-revalidate.
must_understand: boolmust-understand.
no_transform: boolno-transform.
immutable: boolimmutable (RFC 8246).
stale_while_revalidate: Option<u32>stale-while-revalidate (RFC 5861).
stale_if_error: Option<u32>stale-if-error (RFC 5861).
duplicates: boolA known directive appeared more than once.
invalid_values: boolA known directive had an argument that does not fit its grammar.
unknown: u16The number of extension directives (saturating).