entity_tag

Struct 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 for EntityTag<'t>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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> StructuralPartialEq for EntityTag<'t>

Auto Trait Implementations§

§

impl<'t> Freeze for EntityTag<'t>

§

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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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 T
where T: Clone,

Source§

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 T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

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

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.