pub enum IfMatch {
Any,
Tags(Vec<ETag>),
}Expand description
Models the If-Match conditional request header (RFC 7232 §3.1).
A request with If-Match: * matches any existing representation.
A request with a list of ETags matches if the current ETag is in the list
(using strong comparison).
Variants§
Any
Matches any existing representation (If-Match: *).
Tags(Vec<ETag>)
Matches if the current ETag is in this list (strong comparison).
Implementations§
Source§impl IfMatch
impl IfMatch
Sourcepub fn matches(&self, current: &ETag) -> bool
pub fn matches(&self, current: &ETag) -> bool
Returns true if the given current ETag satisfies this If-Match
condition using strong comparison per RFC 7232.
use api_bones::etag::{ETag, IfMatch};
// Wildcard matches everything.
assert!(IfMatch::Any.matches(&ETag::strong("v1")));
// Tag list uses strong comparison.
let cond = IfMatch::Tags(vec![ETag::strong("v1"), ETag::strong("v2")]);
assert!(cond.matches(&ETag::strong("v1")));
assert!(!cond.matches(&ETag::strong("v3")));Trait Implementations§
Source§impl<'de> Deserialize<'de> for IfMatch
impl<'de> Deserialize<'de> for IfMatch
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for IfMatch
impl StructuralPartialEq for IfMatch
Auto Trait Implementations§
impl Freeze for IfMatch
impl RefUnwindSafe for IfMatch
impl Send for IfMatch
impl Sync for IfMatch
impl Unpin for IfMatch
impl UnsafeUnpin for IfMatch
impl UnwindSafe for IfMatch
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