pub enum DirectiveKey {
Show 15 variants
MaxAge,
SMaxAge,
NoCache,
NoStore,
Private,
Public,
MustRevalidate,
ProxyRevalidate,
MustUnderstand,
NoTransform,
Immutable,
StaleWhileRevalidate,
StaleIfError,
OnlyIfCached,
Unknown(String),
}Expand description
Cache-Control directive key.
Known RFC 9111 (and common extension) directives are represented as enum variants,
avoiding a heap allocation for every parsed directive. Unknown or extension
directives are preserved via the Unknown variant.
Directive keys are always stored in lowercase, matching the case-insensitive comparison required by the HTTP specification.
Variants§
MaxAge
max-age
SMaxAge
s-maxage
NoCache
no-cache
NoStore
no-store
Private
private
Public
public
MustRevalidate
must-revalidate
ProxyRevalidate
proxy-revalidate
MustUnderstand
must-understand
NoTransform
no-transform
Immutable
immutable
StaleWhileRevalidate
stale-while-revalidate
StaleIfError
stale-if-error
OnlyIfCached
only-if-cached
Unknown(String)
An unknown or extension directive, stored as the original (lowercased) name.
Implementations§
Source§impl DirectiveKey
impl DirectiveKey
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Return the wire-format name of this directive as a &str.
Known variants return a &'static str; Unknown
returns a borrow of the inner String.
Sourcepub fn from_lowercase(s: &str) -> Self
pub fn from_lowercase(s: &str) -> Self
Construct a DirectiveKey from a lowercase &str.
Known directive names are mapped to their enum variant (zero allocation).
Anything else produces Unknown with an owned copy of
the string.
The caller is responsible for lowercasing the input first; this function does not perform case folding.
See also from_lowercase_owned to avoid a
re-allocation when the caller already has an owned String.
Sourcepub fn from_lowercase_owned(s: String) -> Self
pub fn from_lowercase_owned(s: String) -> Self
Construct a DirectiveKey from a lowercase owned String.
Behaves identically to from_lowercase but
takes ownership of the String, avoiding a re-allocation when the
input maps to Unknown.
Trait Implementations§
Source§impl Clone for DirectiveKey
impl Clone for DirectiveKey
Source§fn clone(&self) -> DirectiveKey
fn clone(&self) -> DirectiveKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DirectiveKey
impl Debug for DirectiveKey
Source§impl Display for DirectiveKey
impl Display for DirectiveKey
impl Eq for DirectiveKey
Source§impl Hash for DirectiveKey
impl Hash for DirectiveKey
Source§impl PartialEq for DirectiveKey
impl PartialEq for DirectiveKey
Source§impl PartialEq<&str> for DirectiveKey
impl PartialEq<&str> for DirectiveKey
Source§impl PartialEq<str> for DirectiveKey
impl PartialEq<str> for DirectiveKey
impl StructuralPartialEq for DirectiveKey
Auto Trait Implementations§
impl Freeze for DirectiveKey
impl RefUnwindSafe for DirectiveKey
impl Send for DirectiveKey
impl Sync for DirectiveKey
impl Unpin for DirectiveKey
impl UnsafeUnpin for DirectiveKey
impl UnwindSafe for DirectiveKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.