Struct http_types::cache::Age
source · pub struct Age { /* private fields */ }
Expand description
HTTP Age
header
Specifications
Examples
use http_types::Response;
use http_types::cache::Age;
let age = Age::from_secs(12);
let mut res = Response::new(200);
age.apply(&mut res);
let age = Age::from_headers(res)?.unwrap();
assert_eq!(age, Age::from_secs(12));
Implementations§
source§impl Age
impl Age
sourcepub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
Create an instance of Age
from a Headers
instance.
sourcepub fn apply(&self, headers: impl AsMut<Headers>)
pub fn apply(&self, headers: impl AsMut<Headers>)
Insert a HeaderName
+ HeaderValue
pair into a Headers
instance.
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
.
Trait Implementations§
source§impl Ord for Age
impl Ord for Age
source§impl PartialOrd<Age> for Age
impl PartialOrd<Age> for Age
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl ToHeaderValues for Age
impl ToHeaderValues for Age
§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
.impl Eq for Age
impl StructuralEq for Age
impl StructuralPartialEq for Age
Auto Trait Implementations§
impl RefUnwindSafe for Age
impl Send for Age
impl Sync for Age
impl Unpin for Age
impl UnwindSafe for Age
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