Struct entity_tag::EntityTag

source ·
pub struct EntityTag<'t> {
    pub weak: bool,
    /* private fields */
}
Expand description

An entity tag, defined in RFC7232.

Fields§

§weak: bool

Whether to have a weakness indicator.

Implementations§

source§

impl<'t> EntityTag<'t>

source

pub const HEADER_NAME: &'static str = "ETag"

ETag

source§

impl<'t> EntityTag<'t>

source

pub const unsafe fn new_unchecked(weak: bool, tag: Cow<'t, str>) -> Self

Construct a new EntityTag without checking.

source

pub const fn get_tag_cow(&self) -> &Cow<'t, str>

Get the tag. The double quotes are not included.

source§

impl<'t> EntityTag<'t>

source

pub unsafe fn with_string_unchecked<S: Into<String>>( weak: bool, tag: S ) -> EntityTag<'static>

Construct a new EntityTag without checking.

source

pub unsafe fn with_str_unchecked<S: ?Sized + AsRef<str>>( weak: bool, tag: &'t S ) -> Self

Construct a new EntityTag without checking.

source§

impl<'t> EntityTag<'t>

source

pub fn with_string<S: AsRef<str> + Into<String>>( weak: bool, tag: S ) -> Result<EntityTag<'static>, EntityTagError>

Construct a new EntityTag.

source

pub fn with_str<S: ?Sized + AsRef<str>>( weak: bool, tag: &'t S ) -> Result<Self, EntityTagError>

Construct a new EntityTag.

source§

impl<'t> EntityTag<'t>

source

pub fn from_string<S: AsRef<str> + Into<String>>( etag: S ) -> Result<EntityTag<'static>, EntityTagError>

Parse and construct a new EntityTag from a String.

source

pub fn from_str<S: ?Sized + AsRef<str>>( etag: &'t S ) -> Result<Self, EntityTagError>

Parse and construct a new EntityTag from a str.

source

pub fn from_data<S: ?Sized + AsRef<[u8]>>(data: &S) -> EntityTag<'static>

Construct a strong EntityTag.

source

pub fn from_file_meta(metadata: &Metadata) -> EntityTag<'static>

Construct a weak EntityTag.

source§

impl<'t> EntityTag<'t>

source

pub fn get_tag(&'t self) -> &'t str

Get the tag. The double quotes are not included.

source

pub fn into_tag(self) -> Cow<'t, str>

Into the tag. The double quotes are not included.

source

pub fn into_owned(self) -> EntityTag<'static>

Extracts the owned data.

source§

impl<'t> EntityTag<'t>

source

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.

source

pub fn weak_eq(&self, other: &EntityTag<'_>) -> bool

For weak comparison two entity-tags are equivalent if their opaque-tags match character-by-character, regardless of either or both being tagged as “weak”.

source

pub fn strong_ne(&self, other: &EntityTag<'_>) -> bool

The inverse of strong_eq.

source

pub fn weak_ne(&self, other: &EntityTag<'_>) -> bool

The inverse of weak_eq.

Trait Implementations§

source§

impl<'t> Clone for EntityTag<'t>

source§

fn clone(&self) -> EntityTag<'t>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'t> Debug for EntityTag<'t>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'t> Display for EntityTag<'t>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'t> PartialEq<EntityTag<'t>> for EntityTag<'t>

source§

fn eq(&self, other: &EntityTag<'t>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'t> Eq for EntityTag<'t>

source§

impl<'t> StructuralEq for EntityTag<'t>

source§

impl<'t> StructuralPartialEq for EntityTag<'t>

Auto Trait Implementations§

§

impl<'t> RefUnwindSafe for EntityTag<'t>

§

impl<'t> Send for EntityTag<'t>

§

impl<'t> Sync for EntityTag<'t>

§

impl<'t> Unpin for EntityTag<'t>

§

impl<'t> UnwindSafe for EntityTag<'t>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.