[−][src]Enum tide::http::conditional::ETag
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.
pub fn to_header_values(&self) -> Result<<ETag as ToHeaderValues>::Iter, Error>
[src]
Auto Trait Implementations
impl RefUnwindSafe for ETag
[src]
impl Send for ETag
[src]
impl Sync for ETag
[src]
impl Unpin for ETag
[src]
impl UnwindSafe for ETag
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,