Struct http_types_rs::conditional::IfUnmodifiedSince
source · pub struct IfUnmodifiedSince { /* private fields */ }
Expand description
Apply the HTTP method if the entity has not been modified after the given date.
§Specifications
§Examples
use http_types_rs::Response;
use http_types_rs::conditional::IfUnmodifiedSince;
use std::time::{SystemTime, Duration};
let time = SystemTime::now() + Duration::from_secs(5 * 60);
let expires = IfUnmodifiedSince::new(time);
let mut res = Response::new(200);
res.insert_header(&expires, &expires);
let expires = IfUnmodifiedSince::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 IfUnmodifiedSince
impl IfUnmodifiedSince
sourcepub fn new(instant: SystemTime) -> Self
pub fn new(instant: SystemTime) -> Self
Create a new instance of IfUnmodifiedSince
.
sourcepub fn modified(&self) -> SystemTime
pub fn modified(&self) -> SystemTime
Returns the last modification time listed.
Trait Implementations§
source§impl Debug for IfUnmodifiedSince
impl Debug for IfUnmodifiedSince
source§impl Header for IfUnmodifiedSince
impl Header for IfUnmodifiedSince
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 IfUnmodifiedSince
impl Ord for IfUnmodifiedSince
source§fn cmp(&self, other: &IfUnmodifiedSince) -> Ordering
fn cmp(&self, other: &IfUnmodifiedSince) -> 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 IfUnmodifiedSince
impl PartialEq for IfUnmodifiedSince
source§fn eq(&self, other: &IfUnmodifiedSince) -> bool
fn eq(&self, other: &IfUnmodifiedSince) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for IfUnmodifiedSince
impl PartialOrd for IfUnmodifiedSince
source§fn partial_cmp(&self, other: &IfUnmodifiedSince) -> Option<Ordering>
fn partial_cmp(&self, other: &IfUnmodifiedSince) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for IfUnmodifiedSince
impl StructuralPartialEq for IfUnmodifiedSince
Auto Trait Implementations§
impl Freeze for IfUnmodifiedSince
impl RefUnwindSafe for IfUnmodifiedSince
impl Send for IfUnmodifiedSince
impl Sync for IfUnmodifiedSince
impl Unpin for IfUnmodifiedSince
impl UnwindSafe for IfUnmodifiedSince
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> ToHeaderValues for Twhere
T: Header,
impl<T> ToHeaderValues for Twhere
T: Header,
§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
.