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§
Source§impl<'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.
§Safety
The caller must ensure tag is a valid unquoted entity-tag value, because this function skips all validation.
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.
Source§impl<'t> EntityTag<'t>
impl<'t> EntityTag<'t>
Source§impl<'t> EntityTag<'t>
impl<'t> EntityTag<'t>
Sourcepub fn with_string<S: AsRef<str> + Into<String>>(
weak: bool,
tag: S,
) -> Result<EntityTag<'static>, EntityTagError>
pub fn with_string<S: AsRef<str> + Into<String>>( weak: bool, tag: S, ) -> Result<EntityTag<'static>, EntityTagError>
Construct a new EntityTag from an opaque tag, with or without surrounding double quotes.
Source§impl<'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 full ETag header value.
Source§impl<'t> EntityTag<'t>
impl<'t> EntityTag<'t>
Sourcepub fn strong_eq(&self, other: &EntityTag<'_>) -> bool
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.
Trait Implementations§
impl<'t> Eq for EntityTag<'t>
Source§impl<'t> PartialEq for EntityTag<'t>
impl<'t> PartialEq for EntityTag<'t>
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> UnsafeUnpin for EntityTag<'t>
impl<'t> UnwindSafe for EntityTag<'t>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more