[][src]Struct surf::http::conditional::IfModifiedSince

pub struct IfModifiedSince { /* fields omitted */ }

Apply the HTTP method if the entity has been modified after the given date.

Specifications

Examples

use http_types::Response;
use http_types::conditional::IfModifiedSince;
use std::time::{SystemTime, Duration};

let time = SystemTime::now() + Duration::from_secs(5 * 60);
let expires = IfModifiedSince::new(time);

let mut res = Response::new(200);
expires.apply(&mut res);

let expires = IfModifiedSince::from_headers(res)?.unwrap();

// HTTP dates only have second-precision.
let elapsed = time.duration_since(expires.modified())?;
assert_eq!(elapsed.as_secs(), 0);

Implementations

impl IfModifiedSince[src]

pub fn new(instant: SystemTime) -> IfModifiedSince[src]

Create a new instance of IfModifiedSince.

pub fn modified(&self) -> SystemTime[src]

Returns the last modification time listed.

pub fn from_headers(
    headers: impl AsRef<Headers>
) -> Result<Option<IfModifiedSince>, Error>
[src]

Create an instance of IfModifiedSince 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 Debug for IfModifiedSince[src]

impl Eq for IfModifiedSince[src]

impl Ord for IfModifiedSince[src]

impl PartialEq<IfModifiedSince> for IfModifiedSince[src]

impl PartialOrd<IfModifiedSince> for IfModifiedSince[src]

impl StructuralEq for IfModifiedSince[src]

impl StructuralPartialEq for IfModifiedSince[src]

impl ToHeaderValues for IfModifiedSince[src]

type Iter = IntoIter<HeaderValue>

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

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]