pub struct Vary { /* private fields */ }
Expand description
Apply the HTTP method if the ETag matches.
§Specifications
§Examples
use http_types::Response;
use http_types::conditional::Vary;
let mut entries = Vary::new();
entries.push("User-Agent")?;
entries.push("Accept-Encoding")?;
let mut res = Response::new(200);
entries.apply(&mut res);
let entries = Vary::from_headers(res)?.unwrap();
let mut entries = entries.iter();
assert_eq!(entries.next().unwrap(), "User-Agent");
assert_eq!(entries.next().unwrap(), "Accept-Encoding");
Implementations§
Source§impl Vary
impl Vary
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 set_wildcard(&mut self, wildcard: bool)
pub fn set_wildcard(&mut self, wildcard: bool)
Set the wildcard directive.
Sourcepub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations§
Source§impl<'a> IntoIterator for &'a Vary
impl<'a> IntoIterator for &'a Vary
Source§impl<'a> IntoIterator for &'a mut Vary
impl<'a> IntoIterator for &'a mut Vary
Source§impl IntoIterator for Vary
impl IntoIterator for Vary
Source§impl ToHeaderValues for Vary
impl ToHeaderValues for Vary
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 Vary
impl RefUnwindSafe for Vary
impl Send for Vary
impl Sync for Vary
impl Unpin for Vary
impl UnwindSafe for Vary
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