[][src]Enum tide::http::conditional::ETag

pub enum ETag {
    Strong(String),
    Weak(String),
}

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[src]

pub fn new(s: String) -> ETag[src]

Create a new ETag that uses strong validation.

pub fn new_weak(s: String) -> ETag[src]

Create a new ETag that uses weak validation.

pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<ETag>, Error>[src]

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 apply(&self, headers: impl AsMut<Headers>)[src]

Sets the ETag header.

pub fn name(&self) -> HeaderName[src]

Get the HeaderName.

pub fn value(&self) -> HeaderValue[src]

Get the HeaderValue.

pub fn is_strong(&self) -> bool[src]

Returns true if the ETag is a Strong value.

pub fn is_weak(&self) -> bool[src]

Returns true if the ETag is a Weak value.

Trait Implementations

impl Clone for ETag[src]

impl Debug for ETag[src]

impl Display for ETag[src]

impl Eq for ETag[src]

impl PartialEq<ETag> for ETag[src]

impl StructuralEq for ETag[src]

impl StructuralPartialEq for ETag[src]

impl ToHeaderValues for ETag[src]

type Iter = IntoIter<HeaderValue>

Returned iterator over header values which this type may correspond to.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,