pub struct IfNoneMatch { /* private fields */ }
Expand description
Apply the HTTP method if the ETags do not match.
This is used to update caches or to prevent uploading a new resource when one already exists.
§Specifications
§Examples
use http_types::Response;
use http_types::conditional::{IfNoneMatch, ETag};
let mut entries = IfNoneMatch::new();
entries.push(ETag::new("0xcafebeef".to_string()));
entries.push(ETag::new("0xbeefcafe".to_string()));
let mut res = Response::new(200);
entries.apply(&mut res);
let entries = IfNoneMatch::from_headers(res)?.unwrap();
let mut entries = entries.iter();
assert_eq!(entries.next().unwrap(), &ETag::new("0xcafebeef".to_string()));
assert_eq!(entries.next().unwrap(), &ETag::new("0xbeefcafe".to_string()));
Implementations§
Source§impl IfNoneMatch
impl IfNoneMatch
Sourcepub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
Create a new instance from headers.
Sourcepub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
Sourcepub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Sourcepub fn set_wildcard(&mut self, wildcard: bool)
pub fn set_wildcard(&mut self, wildcard: bool)
Set the wildcard directive.
Trait Implementations§
Source§impl Debug for IfNoneMatch
impl Debug for IfNoneMatch
Source§impl<'a> IntoIterator for &'a IfNoneMatch
impl<'a> IntoIterator for &'a IfNoneMatch
Source§impl<'a> IntoIterator for &'a mut IfNoneMatch
impl<'a> IntoIterator for &'a mut IfNoneMatch
Source§impl IntoIterator for IfNoneMatch
impl IntoIterator for IfNoneMatch
Source§impl ToHeaderValues for IfNoneMatch
impl ToHeaderValues for IfNoneMatch
Source§type Iter = IntoIter<HeaderValue>
type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
Source§fn to_header_values(&self) -> Result<Self::Iter>
fn to_header_values(&self) -> Result<Self::Iter>
Converts this object to an iterator of resolved
HeaderValues
.Auto Trait Implementations§
impl Freeze for IfNoneMatch
impl RefUnwindSafe for IfNoneMatch
impl Send for IfNoneMatch
impl Sync for IfNoneMatch
impl Unpin 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