pub enum CacheDirective {
Show 15 variants Immutable, MaxAge(Duration), MaxStale(Option<Duration>), MinFresh(Duration), MustRevalidate, NoCache, NoStore, NoTransform, OnlyIfCached, Private, ProxyRevalidate, Public, SMaxAge(Duration), StaleIfError(Duration), StaleWhileRevalidate(Duration),
}
Expand description

An HTTP Cache-Control directive.

Variants (Non-exhaustive)§

This enum is marked as 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

pub fn valid_in_req(&self) -> bool

Check whether this directive is valid in an HTTP request.

pub fn valid_in_res(&self) -> bool

Check whether this directive is valid in an HTTP response.

Trait Implementations§

§

impl Clone for CacheDirective

§

fn clone(&self) -> CacheDirective

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for CacheDirective

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl From<CacheDirective> for HeaderValue

§

fn from(directive: CacheDirective) -> HeaderValue

Converts to this type from the input type.
§

impl PartialEq<CacheDirective> for CacheDirective

§

fn eq(&self, other: &CacheDirective) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Eq for CacheDirective

§

impl StructuralEq for CacheDirective

§

impl StructuralPartialEq for CacheDirective

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

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

§

fn vzip(self) -> V