[][src]Struct tide::http::other::Date

pub struct Date { /* fields omitted */ }

The date and time at which the message originated.

Specifications

Examples

use http_types::Response;
use http_types::other::Date;

use std::time::{Duration, SystemTime};

let now = SystemTime::now();
let date = Date::new(now);

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

let date = Date::from_headers(res)?.unwrap();

// Validate we're within 1 second accurate of the system time.
assert!(now.duration_since(date.into())? <= Duration::from_secs(1));

Implementations

impl Date[src]

pub fn new(at: SystemTime) -> Date[src]

Create a new instance.

pub fn now() -> Date[src]

Create a new instance with the date set to now.

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

Create a new instance from headers.

pub fn apply(&self, headers: impl AsMut<Headers>)[src]

Sets the header.

pub fn name(&self) -> HeaderName[src]

Get the HeaderName.

pub fn value(&self) -> HeaderValue[src]

Get the HeaderValue.

Trait Implementations

impl Debug for Date[src]

impl From<SystemTime> for Date[src]

impl PartialEq<SystemTime> for Date[src]

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, 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>,