Struct http_types::conditional::LastModified [−][src]
pub struct LastModified { /* fields omitted */ }The last modification date of a resource.
Specifications
Examples
use http_types::Response; use http_types::conditional::LastModified; use std::time::{SystemTime, Duration}; let time = SystemTime::now() + Duration::from_secs(5 * 60); let last_modified = LastModified::new(time); let mut res = Response::new(200); last_modified.apply(&mut res); let last_modified = LastModified::from_headers(res)?.unwrap(); // HTTP dates only have second-precision. let elapsed = time.duration_since(last_modified.modified())?; assert_eq!(elapsed.as_secs(), 0);
Implementations
impl LastModified[src]
impl LastModified[src]pub fn new(instant: SystemTime) -> Self[src]
Create a new instance of LastModified.
pub fn modified(&self) -> SystemTime[src]
Returns the last modification time listed.
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>[src]
Create an instance of LastModified from a Headers instance.
pub fn apply(&self, headers: impl AsMut<Headers>)[src]
Insert a HeaderName + HeaderValue pair into a Headers instance.
pub fn name(&self) -> HeaderName[src]
Get the HeaderName.
pub fn value(&self) -> HeaderValue[src]
Get the HeaderValue.
Trait Implementations
impl Eq for LastModified[src]
impl Eq for LastModified[src]impl Ord for LastModified[src]
impl Ord for LastModified[src]impl PartialEq<LastModified> for LastModified[src]
impl PartialEq<LastModified> for LastModified[src]fn eq(&self, other: &LastModified) -> bool[src]
fn ne(&self, other: &LastModified) -> bool[src]
impl PartialOrd<LastModified> for LastModified[src]
impl PartialOrd<LastModified> for LastModified[src]fn partial_cmp(&self, other: &LastModified) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
pub fn le(&self, other: &Rhs) -> bool#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
pub fn ge(&self, other: &Rhs) -> boolimpl StructuralEq for LastModified[src]
impl StructuralEq for LastModified[src]impl StructuralPartialEq for LastModified[src]
impl StructuralPartialEq for LastModified[src]impl ToHeaderValues for LastModified[src]
impl ToHeaderValues for LastModified[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 LastModified
impl RefUnwindSafe for LastModifiedimpl Send for LastModified
impl Send for LastModifiedimpl Sync for LastModified
impl Sync for LastModifiedimpl Unpin for LastModified
impl Unpin for LastModifiedimpl UnwindSafe for LastModified
impl UnwindSafe for LastModified