Struct http_types::cache::CacheControl[][src]

pub struct CacheControl { /* fields omitted */ }
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

Create a new instance of CacheControl.

Create a new instance from headers.

Sets the Server-Timing header.

Get the HeaderName.

Get the HeaderValue.

Push a directive into the list of entries.

An iterator visiting all server entries.

An iterator visiting all server entries.

Trait Implementations

Formats the value using the given formatter. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Returned iterator over header values which this type may correspond to.

Converts this object to an iterator of resolved HeaderValues.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.