Enum actix_web_lab::header::CacheDirective

source ·
#[non_exhaustive]
pub enum CacheDirective {
Show 17 variants MaxAge(u32), MaxStale(u32), MinFresh(u32), SMaxAge(u32), NoCache, NoStore, NoTransform, OnlyIfCached, MustRevalidate, ProxyRevalidate, MustUnderstand, Private, Public, Immutable, StaleWhileRevalidate, StaleIfError, Extension(String, Option<String>),
}
Expand description

Directives contained in a CacheControl header.

Read more on MDN.

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.
§

MaxAge(u32)

The max-age=N directive.

When used as a request directive, it indicates that the client allows a stored response that is generated on the origin server within N seconds — where N may be any non-negative integer (including 0). Read more on MDN.

When used as a response directive, it indicates that the response remains fresh until N seconds after the response is generated. Read more on MDN.

§

MaxStale(u32)

The max-stale=N request directive.

This directive indicates that the client allows a stored response that is stale within N seconds. Read more on MDN.

§

MinFresh(u32)

The min-fresh=N request directive.

This directive indicates that the client allows a stored response that is fresh for at least N seconds. Read more on MDN.

§

SMaxAge(u32)

The s-maxage=N response directive.

This directive also indicates how long the response is fresh for (similar to max-age)—but it is specific to shared caches, and they will ignore max-age when it is present. Read more on MDN.

§

NoCache

The no-cache directive.

When used as a request directive, it asks caches to validate the response with the origin server before reuse. Read more on MDN.

When used as a response directive, it indicates that the response can be stored in caches, but the response must be validated with the origin server before each reuse, even when the cache is disconnected from the origin server. Read more on MDN.

§

NoStore

The no-store directive.

When used as a request directive, it allows a client to request that caches refrain from storing the request and corresponding response — even if the origin server’s response could be stored. Read more on MDN.

When used as a response directive, it indicates that the response can be stored in caches, but the response must be validated with the origin server before each reuse, even when the cache is disconnected from the origin server. Read more on MDN.

§

NoTransform

The no-transform directive.

This directive, in both request and response contexts, indicates that any intermediary (regardless of whether it implements a cache) shouldn’t transform the response contents. Read more on MDN.

§

OnlyIfCached

The only-if-cached request directive.

This directive indicates that caches should obtain an already-cached response. If a cache has stored a response, it’s reused. Read more on MDN.

§

MustRevalidate

The must-revalidate response directive.

This directive indicates that the response can be stored in caches and can be reused while fresh. If the response becomes stale, it must be validated with the origin server before reuse. Read more on MDN.

§

ProxyRevalidate

The proxy-revalidate response directive.

This directive is the equivalent of must-revalidate, but specifically for shared caches only. Read more on MDN.

§

MustUnderstand

The must-understand response directive.

This directive indicates that a cache should store the response only if it understands the requirements for caching based on status code. Read more on MDN.

§

Private

The private response directive.

This directive indicates that the response can be stored only in a private cache (e.g. local caches in browsers). Read more on MDN.

§

Public

The public response directive.

This directive indicates that the response can be stored in a shared cache. Responses for requests with Authorization header fields must not be stored in a shared cache; however, the public directive will cause such responses to be stored in a shared cache. Read more on MDN.

§

Immutable

The immutable response directive.

This directive indicates that the response will not be updated while it’s fresh. Read more on MDN.

§

StaleWhileRevalidate

The stale-while-revalidate response directive.

This directive indicates that the cache could reuse a stale response while it revalidates it to a cache. Read more on MDN.

§

StaleIfError

The stale-if-error directive.

When used as a response directive, it indicates that the cache can reuse a stale response when an origin server responds with an error (500, 502, 503, or 504). Read more on MDN.

§

Extension(String, Option<String>)

Extension directive.

An unknown directives is collected into this variant with an optional argument value.

Trait Implementations§

source§

impl Clone for CacheDirective

source§

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
source§

impl Debug for CacheDirective

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for CacheDirective

source§

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

Formats the value using the given formatter. Read more
source§

impl FromStr for CacheDirective

§

type Err = Option<<u32 as FromStr>::Err>

The associated error which can be returned from parsing.
source§

fn from_str(dir: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl PartialEq for CacheDirective

source§

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.
source§

impl Eq for CacheDirective

source§

impl StructuralPartialEq for CacheDirective

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where 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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.
source§

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

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more