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 new() -> CacheControl
pub fn new() -> CacheControl
Construct a new empty CacheControl
header.
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) -> CacheControl
pub fn with_no_cache(self) -> CacheControl
Set the no-cache
directive.
sourcepub fn with_no_store(self) -> CacheControl
pub fn with_no_store(self) -> CacheControl
Set the no-store
directive.
sourcepub fn with_no_transform(self) -> CacheControl
pub fn with_no_transform(self) -> CacheControl
Set the no-transform
directive.
sourcepub fn with_only_if_cached(self) -> CacheControl
pub fn with_only_if_cached(self) -> CacheControl
Set the only-if-cached
directive.
sourcepub fn with_private(self) -> CacheControl
pub fn with_private(self) -> CacheControl
Set the private
directive.
sourcepub fn with_public(self) -> CacheControl
pub fn with_public(self) -> CacheControl
Set the public
directive.
sourcepub fn with_max_age(self, seconds: Duration) -> CacheControl
pub fn with_max_age(self, seconds: Duration) -> CacheControl
Set the max-age
directive.
sourcepub fn with_max_stale(self, seconds: Duration) -> CacheControl
pub fn with_max_stale(self, seconds: Duration) -> CacheControl
Set the max-stale
directive.
sourcepub fn with_min_fresh(self, seconds: Duration) -> CacheControl
pub fn with_min_fresh(self, seconds: Duration) -> CacheControl
Set the min-fresh
directive.
sourcepub fn with_s_max_age(self, seconds: Duration) -> CacheControl
pub fn with_s_max_age(self, seconds: Duration) -> CacheControl
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 more
sourceimpl Debug for CacheControl
impl Debug for CacheControl
sourceimpl Header for CacheControl
impl Header for CacheControl
sourcefn name() -> &'static HeaderName
fn name() -> &'static HeaderName
The name of this header.
sourcefn decode<'i, I>(values: &mut I) -> Result<CacheControl, Error> where
I: Iterator<Item = &'i HeaderValue>,
fn decode<'i, I>(values: &mut I) -> Result<CacheControl, Error> where
I: Iterator<Item = &'i HeaderValue>,
Decode this type from an iterator of HeaderValue
s.
sourceimpl PartialEq<CacheControl> for CacheControl
impl PartialEq<CacheControl> for CacheControl
sourcefn eq(&self, other: &CacheControl) -> bool
fn eq(&self, other: &CacheControl) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &CacheControl) -> bool
fn ne(&self, other: &CacheControl) -> bool
This method tests for !=
.
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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more