pub struct ETag(pub EntityTag);
Expand description
ETag
header, defined in
RFC 7232 §2.3
The ETag
header field in a response provides the current entity-tag
for the selected representation, as determined at the conclusion of
handling the request. An entity-tag is an opaque validator for
differentiating between multiple representations of the same
resource, regardless of whether those multiple representations are
due to resource state changes over time, content negotiation
resulting in multiple representations being valid at the same time,
or both. An entity-tag consists of an opaque quoted string, possibly
prefixed by a weakness indicator.
ABNF
ETag = entity-tag
Example Values
"xyzzy"
W/"xyzzy"
""
Examples
use actix_web::HttpResponse;
use actix_web::http::header::{ETag, EntityTag};
let mut builder = HttpResponse::Ok();
builder.insert_header(
ETag(EntityTag::new(false, "xyzzy".to_owned()))
);
use actix_web::HttpResponse;
use actix_web::http::header::{ETag, EntityTag};
let mut builder = HttpResponse::Ok();
builder.insert_header(
ETag(EntityTag::new(true, "xyzzy".to_owned()))
);
Tuple Fields
0: EntityTag
Methods from Deref<Target = EntityTag>
sourcepub fn strong_eq(&self, other: &EntityTag) -> bool
pub fn strong_eq(&self, other: &EntityTag) -> bool
For strong comparison two entity-tags are equivalent if both are not weak and their opaque-tags match character-by-character.
Trait Implementations
sourceimpl Header for ETag
impl Header for ETag
sourcefn name() -> HeaderName
fn name() -> HeaderName
Returns the name of the header field
sourcefn parse<M: HttpMessage>(msg: &M) -> Result<Self, ParseError>
fn parse<M: HttpMessage>(msg: &M) -> Result<Self, ParseError>
Parse a header
sourceimpl TryIntoHeaderValue for ETag
impl TryIntoHeaderValue for ETag
type Error = InvalidHeaderValue
type Error = InvalidHeaderValue
The type returned in the event of a conversion error.
sourcefn try_into_value(self) -> Result<HeaderValue, Self::Error>
fn try_into_value(self) -> Result<HeaderValue, Self::Error>
Try to convert value to a HeaderValue.
impl Eq for ETag
impl StructuralEq for ETag
impl StructuralPartialEq for ETag
Auto Trait Implementations
impl RefUnwindSafe for ETag
impl Send for ETag
impl Sync for ETag
impl Unpin for ETag
impl UnwindSafe for ETag
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> TryIntoHeaderPair for T where
T: Header,
impl<T> TryIntoHeaderPair for T where
T: Header,
type Error = <T as TryIntoHeaderValue>::Error
fn try_into_pair(
self
) -> Result<(HeaderName, HeaderValue), <T as TryIntoHeaderPair>::Error>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more