Enum http_types::conditional::ETag[][src]

pub enum ETag {
    Strong(String),
    Weak(String),
}
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

An ETag using strong validation.

Tuple Fields of Strong

0: String
Weak

An ETag using weak validation.

Tuple Fields of Weak

0: String

Implementations

Create a new ETag that uses strong validation.

Create a new ETag that uses weak validation.

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.

Sets the ETag header.

Get the HeaderName.

Get the HeaderValue.

Returns true if the ETag is a Strong value.

Returns true if the ETag is a Weak value.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Converts this object to an iterator of resolved HeaderValues.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.