Struct b2_client::file::CacheControl
source · [−]pub struct CacheControl { /* private fields */ }Expand description
A Cache-Control header.
Examples
use http_types::Response;
use http_types::cache::{CacheControl, CacheDirective};
let mut entries = CacheControl::new();
entries.push(CacheDirective::Immutable);
entries.push(CacheDirective::NoStore);
let mut res = Response::new(200);
entries.apply(&mut res);
let entries = CacheControl::from_headers(res)?.unwrap();
let mut entries = entries.iter();
assert_eq!(entries.next().unwrap(), &CacheDirective::Immutable);
assert_eq!(entries.next().unwrap(), &CacheDirective::NoStore);Implementations
sourceimpl CacheControl
impl CacheControl
sourcepub fn new() -> CacheControl
pub fn new() -> CacheControl
Create a new instance of CacheControl.
sourcepub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<CacheControl>, Error>
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<CacheControl>, Error>
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 push(&mut self, directive: CacheDirective)
pub fn push(&mut self, directive: CacheDirective)
Push a directive into the list of entries.
Trait Implementations
sourceimpl Debug for CacheControl
impl Debug for CacheControl
sourceimpl<'a> IntoIterator for &'a CacheControl
impl<'a> IntoIterator for &'a CacheControl
type Item = &'a CacheDirective
type Item = &'a CacheDirective
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?
sourcepub fn into_iter(self) -> <&'a CacheControl as IntoIterator>::IntoIter
pub fn into_iter(self) -> <&'a CacheControl as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl<'a> IntoIterator for &'a mut CacheControl
impl<'a> IntoIterator for &'a mut CacheControl
type Item = &'a mut CacheDirective
type Item = &'a mut CacheDirective
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?
sourcepub fn into_iter(self) -> <&'a mut CacheControl as IntoIterator>::IntoIter
pub fn into_iter(self) -> <&'a mut CacheControl as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl IntoIterator for CacheControl
impl IntoIterator for CacheControl
type Item = CacheDirective
type Item = CacheDirective
The type of the elements being iterated over.
type IntoIter = IntoIter
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
sourcepub fn into_iter(self) -> <CacheControl as IntoIterator>::IntoIter
pub fn into_iter(self) -> <CacheControl as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl ToHeaderValues for CacheControl
impl ToHeaderValues for CacheControl
type Iter = IntoIter<HeaderValue>
type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
sourcepub fn to_header_values(
&self
) -> Result<<CacheControl as ToHeaderValues>::Iter, Error>
pub fn to_header_values(
&self
) -> Result<<CacheControl as ToHeaderValues>::Iter, Error>
Converts this object to an iterator of resolved HeaderValues.
Auto Trait Implementations
impl RefUnwindSafe for CacheControl
impl Send for CacheControl
impl Sync for CacheControl
impl Unpin for CacheControl
impl UnwindSafe for CacheControl
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more