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>
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.
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 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.
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>
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> 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