pub enum IfNoneMatch {
Any,
Tags(Vec<ETag>),
}Expand description
Models the If-None-Match conditional request header (RFC 7232 §3.2).
A request with If-None-Match: * fails if any representation exists.
A request with a list of ETags fails (i.e., condition is false) if the
current ETag matches any of the listed ETags (weak comparison).
Variants§
Any
Condition fails if any representation exists (If-None-Match: *).
Tags(Vec<ETag>)
Condition fails if the current ETag weakly matches any of these.
Implementations§
Source§impl IfNoneMatch
impl IfNoneMatch
Sourcepub fn matches(&self, current: &ETag) -> bool
pub fn matches(&self, current: &ETag) -> bool
Returns true when the condition is satisfied (i.e., the server
should proceed with the request).
Per RFC 7232 §3.2, the condition is satisfied when the current ETag
does not weakly match any tag in the list (or no representation
exists for Any).
use api_bones::etag::{ETag, IfNoneMatch};
// Wildcard is never satisfied (any representation exists).
assert!(!IfNoneMatch::Any.matches(&ETag::strong("v1")));
// Satisfied when current tag is NOT in the list.
let cond = IfNoneMatch::Tags(vec![ETag::strong("v1")]);
assert!(cond.matches(&ETag::strong("v2")));
assert!(!cond.matches(&ETag::strong("v1")));Trait Implementations§
Source§impl Clone for IfNoneMatch
impl Clone for IfNoneMatch
Source§fn clone(&self) -> IfNoneMatch
fn clone(&self) -> IfNoneMatch
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IfNoneMatch
impl Debug for IfNoneMatch
Source§impl<'de> Deserialize<'de> for IfNoneMatch
impl<'de> Deserialize<'de> for IfNoneMatch
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
Source§impl PartialEq for IfNoneMatch
impl PartialEq for IfNoneMatch
Source§impl Serialize for IfNoneMatch
impl Serialize for IfNoneMatch
impl Eq for IfNoneMatch
impl StructuralPartialEq for IfNoneMatch
Auto Trait Implementations§
impl Freeze for IfNoneMatch
impl RefUnwindSafe for IfNoneMatch
impl Send for IfNoneMatch
impl Sync for IfNoneMatch
impl Unpin for IfNoneMatch
impl UnsafeUnpin for IfNoneMatch
impl UnwindSafe for IfNoneMatch
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