pub struct IfModifiedSince { /* private fields */ }
Expand description
Apply the HTTP method if the entity has been modified after the given date.
§Specifications
§Examples
use http_types_rs::Response;
use http_types_rs::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);
res.insert_header(&expires, &expires);
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§
Source§impl IfModifiedSince
impl IfModifiedSince
Sourcepub fn new(instant: SystemTime) -> Self
pub fn new(instant: SystemTime) -> Self
Create a new instance of IfModifiedSince
.
Sourcepub fn modified(&self) -> SystemTime
pub fn modified(&self) -> SystemTime
Returns the last modification time listed.
Trait Implementations§
Source§impl Debug for IfModifiedSince
impl Debug for IfModifiedSince
Source§impl Header for IfModifiedSince
impl Header for IfModifiedSince
Source§fn header_name(&self) -> HeaderName
fn header_name(&self) -> HeaderName
Access the header’s name.
Source§fn header_value(&self) -> HeaderValue
fn header_value(&self) -> HeaderValue
Access the header’s value.
Source§impl Ord for IfModifiedSince
impl Ord for IfModifiedSince
Source§fn cmp(&self, other: &IfModifiedSince) -> Ordering
fn cmp(&self, other: &IfModifiedSince) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for IfModifiedSince
impl PartialEq for IfModifiedSince
Source§impl PartialOrd for IfModifiedSince
impl PartialOrd for IfModifiedSince
impl Eq for IfModifiedSince
impl StructuralPartialEq for IfModifiedSince
Auto Trait Implementations§
impl Freeze for IfModifiedSince
impl RefUnwindSafe for IfModifiedSince
impl Send for IfModifiedSince
impl Sync for IfModifiedSince
impl Unpin for IfModifiedSince
impl UnwindSafe for IfModifiedSince
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
Source§impl<T> ToHeaderValues for Twhere
T: Header,
impl<T> ToHeaderValues for Twhere
T: Header,
Source§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<<T as ToHeaderValues>::Iter, Error>
fn to_header_values(&self) -> Result<<T as ToHeaderValues>::Iter, Error>
Converts this object to an iterator of resolved
HeaderValues
.