pub struct CacheControl { /* private fields */ }Expand description
Cache-Control header, defined in RFC7234
with extensions in RFC8246
The Cache-Control header field is used to specify directives for
caches along the request/response chain. Such cache directives are
unidirectional in that the presence of a directive in a request does
not imply that the same directive is to be given in the response.
§ABNF
Cache-Control = 1#cache-directive
cache-directive = token [ "=" ( token / quoted-string ) ]§Example values
no-cacheprivate, community="UCI"max-age=30
§Example
use headers::CacheControl;
let cc = CacheControl::new();Implementations§
Source§impl CacheControl
impl CacheControl
Sourcepub fn no_transform(&self) -> bool
pub fn no_transform(&self) -> bool
Check if the no-transform directive is set.
Sourcepub fn only_if_cached(&self) -> bool
pub fn only_if_cached(&self) -> bool
Check if the only-if-cached directive is set.
Sourcepub fn must_revalidate(&self) -> bool
pub fn must_revalidate(&self) -> bool
Check if the must-revalidate directive is set.
Sourcepub fn must_understand(&self) -> bool
pub fn must_understand(&self) -> bool
Check if the must-understand directive is set.
Sourcepub fn with_no_cache(self) -> Self
pub fn with_no_cache(self) -> Self
Set the no-cache directive.
Sourcepub fn with_no_store(self) -> Self
pub fn with_no_store(self) -> Self
Set the no-store directive.
Sourcepub fn with_no_transform(self) -> Self
pub fn with_no_transform(self) -> Self
Set the no-transform directive.
Sourcepub fn with_only_if_cached(self) -> Self
pub fn with_only_if_cached(self) -> Self
Set the only-if-cached directive.
Sourcepub fn with_private(self) -> Self
pub fn with_private(self) -> Self
Set the private directive.
Sourcepub fn with_public(self) -> Self
pub fn with_public(self) -> Self
Set the public directive.
Sourcepub fn with_immutable(self) -> Self
pub fn with_immutable(self) -> Self
Set the immutable directive.
Sourcepub fn with_must_revalidate(self) -> Self
pub fn with_must_revalidate(self) -> Self
Set the must-revalidate directive.
Sourcepub fn with_must_understand(self) -> Self
pub fn with_must_understand(self) -> Self
Set the must-understand directive.
Sourcepub fn with_max_age(self, duration: Duration) -> Self
pub fn with_max_age(self, duration: Duration) -> Self
Set the max-age directive.
Sourcepub fn with_max_stale(self, duration: Duration) -> Self
pub fn with_max_stale(self, duration: Duration) -> Self
Set the max-stale directive.
Sourcepub fn with_min_fresh(self, duration: Duration) -> Self
pub fn with_min_fresh(self, duration: Duration) -> Self
Set the min-fresh directive.
Sourcepub fn with_s_max_age(self, duration: Duration) -> Self
pub fn with_s_max_age(self, duration: Duration) -> Self
Set the s-maxage directive.
Trait Implementations§
Source§impl Clone for CacheControl
impl Clone for CacheControl
Source§fn clone(&self) -> CacheControl
fn clone(&self) -> CacheControl
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more