#[non_exhaustive]
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

Check whether this directive is valid in an HTTP request.

Check whether this directive is valid in an HTTP response.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.