Struct http_types::other::Date [−][src]
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]
impl Date[src]pub fn new(at: SystemTime) -> Self[src]
Create a new instance.
pub fn now() -> Self[src]
Create a new instance with the date set to now.
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>[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 From<SystemTime> for Date[src]
impl From<SystemTime> for Date[src]fn from(time: SystemTime) -> Self[src]
Auto Trait Implementations
impl RefUnwindSafe for Date
impl RefUnwindSafe for Dateimpl UnwindSafe for Date
impl UnwindSafe for Date