Struct entity_tag::EntityTag
source · [−]pub struct EntityTag<'t> {
pub weak: bool,
/* private fields */
}Expand description
An entity tag, defined in RFC7232.
Fields
weak: boolWhether to have a weakness indicator.
Implementations
sourceimpl<'t> EntityTag<'t>
impl<'t> EntityTag<'t>
sourcepub const HEADER_NAME: &'static str
pub const HEADER_NAME: &'static str
ETag
sourceimpl<'t> EntityTag<'t>
impl<'t> EntityTag<'t>
sourcepub const unsafe fn new_unchecked(weak: bool, tag: Cow<'t, str>) -> Self
pub const unsafe fn new_unchecked(weak: bool, tag: Cow<'t, str>) -> Self
Construct a new EntityTag without checking.
sourcepub const fn get_tag_cow(&self) -> &Cow<'t, str>
pub const fn get_tag_cow(&self) -> &Cow<'t, str>
Get the tag. The double quotes are not included.
sourceimpl<'t> EntityTag<'t>
impl<'t> EntityTag<'t>
sourcepub fn from_string<S: AsRef<str> + Into<String>>(
etag: S
) -> Result<EntityTag<'static>, EntityTagError>
pub fn from_string<S: AsRef<str> + Into<String>>(
etag: S
) -> Result<EntityTag<'static>, EntityTagError>
Parse and construct a new EntityTag from a String.
sourcepub fn from_str<S: ?Sized + AsRef<str>>(
etag: &'t S
) -> Result<Self, EntityTagError>
pub fn from_str<S: ?Sized + AsRef<str>>(
etag: &'t S
) -> Result<Self, EntityTagError>
Parse and construct a new EntityTag from a str.
sourcepub fn from_data<S: ?Sized + AsRef<[u8]>>(data: &S) -> EntityTag<'static>
pub fn from_data<S: ?Sized + AsRef<[u8]>>(data: &S) -> EntityTag<'static>
Construct a strong EntityTag.
sourcepub fn from_file_meta(metadata: &Metadata) -> EntityTag<'static>
pub fn from_file_meta(metadata: &Metadata) -> EntityTag<'static>
Construct a weak EntityTag.
sourceimpl<'t> EntityTag<'t>
impl<'t> EntityTag<'t>
sourcepub fn strong_eq<'v>(&self, other: &EntityTag<'v>) -> bool
pub fn strong_eq<'v>(&self, other: &EntityTag<'v>) -> bool
For strong comparison two entity-tags are equivalent if both are not weak and their opaque-tags match character-by-character.
Trait Implementations
impl<'t> Eq for EntityTag<'t>
impl<'t> StructuralEq for EntityTag<'t>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more