Enum ajars_surf::surf::http::cache::CacheDirective
[−]#[non_exhaustive]
pub enum CacheDirective {
}
Expand description
An HTTP Cache-Control
directive.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Immutable
The response body will not change over time.
MaxAge(Duration)
The maximum amount of time a resource is considered fresh.
MaxStale(Option<Duration>)
Indicates the client will accept a stale response.
MinFresh(Duration)
A response that will still be fresh for at least the specified duration.
MustRevalidate
Once a response is stale, a fresh response must be retrieved.
NoCache
The response may be cached, but must always be revalidated before being used.
NoStore
The response may not be cached.
NoTransform
An intermediate cache or proxy should not edit the response body, Content-Encoding, Content-Range, or Content-Type.
OnlyIfCached
Do not use the network for a response.
Private
The response may be stored only by a browser’s cache, even if the response is normally non-cacheable.
ProxyRevalidate
Like must-revalidate, but only for shared caches (e.g., proxies).
Public
The response may be stored by any cache, even if the response is normally non-cacheable.
SMaxAge(Duration)
Overrides max-age or the Expires header, but only for shared caches.
StaleIfError(Duration)
The client will accept a stale response if retrieving a fresh one fails.
StaleWhileRevalidate(Duration)
Indicates the client will accept a stale response, while asynchronously checking in the background for a fresh one.
Implementations
impl CacheDirective
impl CacheDirective
pub fn valid_in_req(&self) -> bool
pub fn valid_in_req(&self) -> bool
Check whether this directive is valid in an HTTP request.
pub fn valid_in_res(&self) -> bool
pub fn valid_in_res(&self) -> bool
Check whether this directive is valid in an HTTP response.
Trait Implementations
impl Clone for CacheDirective
impl Clone for CacheDirective
fn clone(&self) -> CacheDirective
fn clone(&self) -> CacheDirective
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
impl Debug for CacheDirective
impl Debug for CacheDirective
impl From<CacheDirective> for HeaderValue
impl From<CacheDirective> for HeaderValue
fn from(directive: CacheDirective) -> HeaderValue
fn from(directive: CacheDirective) -> HeaderValue
Converts to this type from the input type.
impl PartialEq<CacheDirective> for CacheDirective
impl PartialEq<CacheDirective> for CacheDirective
fn eq(&self, other: &CacheDirective) -> bool
fn eq(&self, other: &CacheDirective) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &CacheDirective) -> bool
fn ne(&self, other: &CacheDirective) -> bool
This method tests for !=
.
impl Eq for CacheDirective
impl StructuralEq for CacheDirective
impl StructuralPartialEq for CacheDirective
Auto Trait Implementations
impl RefUnwindSafe for CacheDirective
impl Send for CacheDirective
impl Sync for CacheDirective
impl Unpin for CacheDirective
impl UnwindSafe for CacheDirective
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> 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