[][src]Enum surf::http::cache::CacheDirective

#[non_exhaustive]pub enum CacheDirective {
    Immutable,
    MaxAge(Duration),
    MaxStale(Option<Duration>),
    MinFresh(Duration),
    MustRevalidate,
    NoCache,
    NoStore,
    NoTransform,
    OnlyIfCached,
    Private,
    ProxyRevalidate,
    Public,
    SMaxAge(Duration),
    StaleIfError(Duration),
    StaleWhileRevalidate(Duration),
}

An HTTP Cache-Control directive.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
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[src]

pub fn valid_in_req(&self) -> bool[src]

Check whether this directive is valid in an HTTP request.

pub fn valid_in_res(&self) -> bool[src]

Check whether this directive is valid in an HTTP response.

Trait Implementations

impl Clone for CacheDirective[src]

impl Debug for CacheDirective[src]

impl Eq for CacheDirective[src]

impl From<CacheDirective> for HeaderValue[src]

impl PartialEq<CacheDirective> for CacheDirective[src]

impl StructuralEq for CacheDirective[src]

impl StructuralPartialEq for CacheDirective[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]