Enum ajars_surf::surf::http::conditional::ETag
[−]Expand description
HTTP Entity Tags.
ETags provide an ID for a particular resource, enabling clients and servers to reason about caches and make conditional requests.
Specifications
Examples
use http_types::Response;
use http_types::conditional::ETag;
let etag = ETag::new("0xcafebeef".to_string());
let mut res = Response::new(200);
etag.apply(&mut res);
let etag = ETag::from_headers(res)?.unwrap();
assert_eq!(etag, ETag::Strong(String::from("0xcafebeef")));
Variants
Strong(String)
An ETag using strong validation.
Weak(String)
An ETag using weak validation.
Implementations
impl ETag
impl ETag
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<ETag>, Error>
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<ETag>, Error>
Create a new instance from headers.
Only a single ETag per resource is assumed to exist. If multiple ETag headers are found the last one is used.
pub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
pub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations
impl ToHeaderValues for ETag
impl ToHeaderValues for ETag
type Iter = IntoIter<HeaderValue>
type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
fn to_header_values(&self) -> Result<<ETag as ToHeaderValues>::Iter, Error>
fn to_header_values(&self) -> Result<<ETag as ToHeaderValues>::Iter, Error>
Converts this object to an iterator of resolved HeaderValues
.
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<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more