Struct http_types::cache::CacheControl [−][src]
pub struct CacheControl { /* fields omitted */ }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
impl CacheControl[src]
impl CacheControl[src]pub fn new() -> Self[src]
Create a new instance of CacheControl.
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>[src]
Create a new instance from headers.
pub fn apply(&self, headers: impl AsMut<Headers>)[src]
Sets the Server-Timing header.
pub fn name(&self) -> HeaderName[src]
Get the HeaderName.
pub fn value(&self) -> HeaderValue[src]
Get the HeaderValue.
pub fn push(&mut self, directive: CacheDirective)[src]
Push a directive into the list of entries.
pub fn iter(&self) -> Iter<'_>[src]
An iterator visiting all server entries.
pub fn iter_mut(&mut self) -> IterMut<'_>[src]
An iterator visiting all server entries.
Trait Implementations
impl IntoIterator for CacheControl[src]
impl IntoIterator for CacheControl[src]impl<'a> IntoIterator for &'a CacheControl[src]
impl<'a> IntoIterator for &'a CacheControl[src]impl<'a> IntoIterator for &'a mut CacheControl[src]
impl<'a> IntoIterator for &'a mut CacheControl[src]impl ToHeaderValues for CacheControl[src]
impl ToHeaderValues for CacheControl[src]type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
fn to_header_values(&self) -> Result<Self::Iter>[src]
Auto Trait Implementations
impl RefUnwindSafe for CacheControl
impl RefUnwindSafe for CacheControlimpl Send for CacheControl
impl Send for CacheControlimpl Sync for CacheControl
impl Sync for CacheControlimpl Unpin for CacheControl
impl Unpin for CacheControlimpl UnwindSafe for CacheControl
impl UnwindSafe for CacheControl