pub struct CacheControl {
pub directives: DirectiveMap,
}
Expand description
Parsed Cache-Control directives
Fields§
§directives: DirectiveMap
The parsed directives
Implementations§
Source§impl CacheControl
impl CacheControl
Sourcepub fn from_headers_named(
header_name: &str,
headers: &HeaderMap,
) -> Option<Self>
pub fn from_headers_named( header_name: &str, headers: &HeaderMap, ) -> Option<Self>
Parse from the given header name in headers
Sourcepub fn from_req_headers_named(
header_name: &str,
req_header: &ReqHeader,
) -> Option<Self>
pub fn from_req_headers_named( header_name: &str, req_header: &ReqHeader, ) -> Option<Self>
Parse from the given header name in the ReqHeader
Sourcepub fn from_req_headers(req_header: &ReqHeader) -> Option<Self>
pub fn from_req_headers(req_header: &ReqHeader) -> Option<Self>
Parse Cache-Control
header name from the ReqHeader
Sourcepub fn from_resp_headers_named(
header_name: &str,
resp_header: &RespHeader,
) -> Option<Self>
pub fn from_resp_headers_named( header_name: &str, resp_header: &RespHeader, ) -> Option<Self>
Parse from the given header name in the RespHeader
Sourcepub fn from_resp_headers(resp_header: &RespHeader) -> Option<Self>
pub fn from_resp_headers(resp_header: &RespHeader) -> Option<Self>
Parse Cache-Control
header name from the RespHeader
Sourcepub fn private_field_names(&self) -> Option<ListValueIter<'_>>
pub fn private_field_names(&self) -> Option<ListValueIter<'_>>
Get the values of private=
Sourcepub fn no_cache_field_names(&self) -> Option<ListValueIter<'_>>
pub fn no_cache_field_names(&self) -> Option<ListValueIter<'_>>
Get the values of no-cache=
Sourcepub fn stale_while_revalidate(&self) -> Result<Option<u32>>
pub fn stale_while_revalidate(&self) -> Result<Option<u32>>
Return the stale-while-revalidate
seconds
Sourcepub fn stale_if_error(&self) -> Result<Option<u32>>
pub fn stale_if_error(&self) -> Result<Option<u32>>
Return the stale-if-error
seconds
Sourcepub fn must_revalidate(&self) -> bool
pub fn must_revalidate(&self) -> bool
Whether must-revalidate
exists.
Sourcepub fn proxy_revalidate(&self) -> bool
pub fn proxy_revalidate(&self) -> bool
Whether proxy-revalidate
exists.
Sourcepub fn only_if_cached(&self) -> bool
pub fn only_if_cached(&self) -> bool
Whether only-if-cached
exists.
Trait Implementations§
Source§impl Debug for CacheControl
impl Debug for CacheControl
Source§impl InterpretCacheControl for CacheControl
impl InterpretCacheControl for CacheControl
Source§fn is_cacheable(&self) -> Cacheable
fn is_cacheable(&self) -> Cacheable
Does cache-control specify this response is cacheable? Read more
Does this cache-control allow caching a response to
a request with the Authorization header?
Source§fn serve_stale_while_revalidate_sec(&self) -> Option<u32>
fn serve_stale_while_revalidate_sec(&self) -> Option<u32>
Returns stale-while-revalidate ttl, Read more
Source§fn strip_private_headers(&self, resp_header: &mut ResponseHeader)
fn strip_private_headers(&self, resp_header: &mut ResponseHeader)
Strip header names listed in
private
or no-cache
directives from a response,
usually prior to storing that response in cache.Auto Trait Implementations§
impl Freeze for CacheControl
impl RefUnwindSafe for CacheControl
impl Send for CacheControl
impl Sync for CacheControl
impl Unpin for CacheControl
impl UnwindSafe for CacheControl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more