pub enum IfRange<'a> {
Date(HttpDate),
Tag(EntityTag<'a>),
}Expand description
A parsed If-Range value.
Variants§
Implementations§
Source§impl IfRange<'_>
impl IfRange<'_>
Sourcepub fn matches(
&self,
current_tag: Option<&EntityTag<'_>>,
last_modified: Option<HttpDate>,
) -> bool
pub fn matches( &self, current_tag: Option<&EntityTag<'_>>, last_modified: Option<HttpDate>, ) -> bool
Whether the condition holds, so the ranges may be served (RFC 9110
section 13.1.5): a tag matches by strong comparison (a weak tag never
matches); a date matches when it equals last_modified exactly. When
it does not hold, send the whole representation.
§Examples
use parse_net::{range::parse_if_range, EntityTag};
let current = EntityTag::strong(b"v1")?;
assert!(parse_if_range(b"\"v1\"")?.matches(Some(¤t), None));
assert!(!parse_if_range(b"W/\"v1\"")?.matches(Some(¤t), None));Trait Implementations§
impl<'a> Copy for IfRange<'a>
impl<'a> Eq for IfRange<'a>
impl<'a> StructuralPartialEq for IfRange<'a>
Auto Trait Implementations§
impl<'a> Freeze for IfRange<'a>
impl<'a> RefUnwindSafe for IfRange<'a>
impl<'a> Send for IfRange<'a>
impl<'a> Sync for IfRange<'a>
impl<'a> Unpin for IfRange<'a>
impl<'a> UnsafeUnpin for IfRange<'a>
impl<'a> UnwindSafe for IfRange<'a>
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