Struct headers_ext::CacheControl
source · pub struct CacheControl { /* private fields */ }
Expand description
Cache-Control
header, defined in RFC7234
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-cache
private, community="UCI"
max-age=30
Example
use headers::CacheControl;
let cc = CacheControl::new();
Implementations
sourceimpl 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 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_max_age(self, seconds: Duration) -> Self
pub fn with_max_age(self, seconds: Duration) -> Self
Set the max-age
directive.
sourcepub fn with_max_stale(self, seconds: Duration) -> Self
pub fn with_max_stale(self, seconds: Duration) -> Self
Set the max-stale
directive.
sourcepub fn with_min_fresh(self, seconds: Duration) -> Self
pub fn with_min_fresh(self, seconds: Duration) -> Self
Set the min-fresh
directive.
sourcepub fn with_s_max_age(self, seconds: Duration) -> Self
pub fn with_s_max_age(self, seconds: Duration) -> Self
Set the s-maxage
directive.
Trait Implementations
sourceimpl Clone for CacheControl
impl Clone for CacheControl
sourcefn clone(&self) -> CacheControl
fn clone(&self) -> CacheControl
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for CacheControl
impl Debug for CacheControl
sourceimpl Header for CacheControl
impl Header for CacheControl
sourceconst NAME: &'static HeaderName = _
const NAME: &'static HeaderName = _
The name of this header.
sourceimpl PartialEq<CacheControl> for CacheControl
impl PartialEq<CacheControl> for CacheControl
sourcefn eq(&self, other: &CacheControl) -> bool
fn eq(&self, other: &CacheControl) -> bool
impl StructuralPartialEq for CacheControl
Auto Trait Implementations
impl RefUnwindSafe for CacheControl
impl Send for CacheControl
impl Sync for CacheControl
impl Unpin for CacheControl
impl UnwindSafe for CacheControl
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more