Struct ajars_surf::surf::http::conditional::Vary
[−]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
impl Vary
impl Vary
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Vary>, Error>
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Vary>, Error>
Create a new instance from headers.
pub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
pub fn set_wildcard(&mut self, wildcard: bool)
pub fn set_wildcard(&mut self, wildcard: bool)
Set the wildcard directive.
pub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
pub fn push(&mut self, directive: impl Into<HeaderName>) -> Result<(), Error>
pub fn push(&mut self, directive: impl Into<HeaderName>) -> Result<(), Error>
Push a directive into the list of entries.
pub fn iter(&self) -> Iter<'_>
pub fn iter(&self) -> Iter<'_>
An iterator visiting all server entries.
pub fn iter_mut(&mut self) -> IterMut<'_>
pub fn iter_mut(&mut self) -> IterMut<'_>
An iterator visiting all server entries.
Trait Implementations
impl IntoIterator for Vary
impl IntoIterator for Vary
type Item = HeaderName
type Item = HeaderName
The type of the elements being iterated over.
type IntoIter = IntoIter
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> <Vary as IntoIterator>::IntoIter
fn into_iter(self) -> <Vary as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
impl<'a> IntoIterator for &'a Vary
impl<'a> IntoIterator for &'a Vary
type Item = &'a HeaderName
type Item = &'a HeaderName
The type of the elements being iterated over.
type IntoIter = Iter<'a>
type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> <&'a Vary as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a Vary as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
impl<'a> IntoIterator for &'a mut Vary
impl<'a> IntoIterator for &'a mut Vary
type Item = &'a mut HeaderName
type Item = &'a mut HeaderName
The type of the elements being iterated over.
type IntoIter = IterMut<'a>
type IntoIter = IterMut<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> <&'a mut Vary as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a mut Vary as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
impl ToHeaderValues for Vary
impl ToHeaderValues for Vary
type Iter = IntoIter<HeaderValue>
type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
fn to_header_values(&self) -> Result<<Vary as ToHeaderValues>::Iter, Error>
fn to_header_values(&self) -> Result<<Vary as ToHeaderValues>::Iter, Error>
Converts this object to an iterator of resolved HeaderValues
.
Auto Trait Implementations
impl RefUnwindSafe for Vary
impl Send for Vary
impl Sync for Vary
impl Unpin for Vary
impl UnwindSafe for Vary
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more