pub struct ETag {
pub value: String,
pub weak: bool,
}Expand description
An HTTP ETag header value, either strong or weak.
Fields§
§value: StringThe opaque tag value (without surrounding quotes or W/ prefix).
weak: booltrue if this is a weak ETag (W/"…").
Implementations§
Source§impl ETag
impl ETag
Sourcepub fn from_bytes(data: &[u8]) -> Self
pub fn from_bytes(data: &[u8]) -> Self
Creates a strong ETag whose value is the FNV-1a 64-bit hash of data.
Sourcepub fn from_str_value(s: &str) -> Self
pub fn from_str_value(s: &str) -> Self
Creates a strong ETag with an explicit string value.
Sourcepub fn to_header_value(&self) -> String
pub fn to_header_value(&self) -> String
Formats the ETag as an HTTP header value: "value" or W/"value".
Sourcepub fn parse(s: &str) -> Result<Self, CacheError>
pub fn parse(s: &str) -> Result<Self, CacheError>
Parses an ETag from an HTTP header value.
Accepts "value" (strong) and W/"value" (weak).
§Errors
Returns CacheError::InvalidETag if the string is not a valid ETag.
Trait Implementations§
impl Eq for ETag
impl StructuralPartialEq for ETag
Auto Trait Implementations§
impl Freeze for ETag
impl RefUnwindSafe for ETag
impl Send for ETag
impl Sync for ETag
impl Unpin for ETag
impl UnsafeUnpin for ETag
impl UnwindSafe for ETag
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
Mutably borrows from an owned value. Read more
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
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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