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>
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§
source§impl<'t> PartialEq<EntityTag<'t>> for EntityTag<'t>
impl<'t> PartialEq<EntityTag<'t>> for EntityTag<'t>
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§
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