Struct ajars_surf::surf::http::conditional::IfUnmodifiedSince
[−]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::Response;
use http_types::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);
expires.apply(&mut res);
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
impl IfUnmodifiedSince
impl IfUnmodifiedSince
pub fn new(instant: SystemTime) -> IfUnmodifiedSince
pub fn new(instant: SystemTime) -> IfUnmodifiedSince
Create a new instance of IfUnmodifiedSince
.
pub fn modified(&self) -> SystemTime
pub fn modified(&self) -> SystemTime
Returns the last modification time listed.
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<IfUnmodifiedSince>, Error>
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<IfUnmodifiedSince>, Error>
Create an instance of IfUnmodifiedSince
from a Headers
instance.
pub fn apply(&self, headers: impl AsMut<Headers>)
pub fn apply(&self, headers: impl AsMut<Headers>)
Insert a HeaderName
+ HeaderValue
pair into a Headers
instance.
pub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
pub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations
impl Debug for IfUnmodifiedSince
impl Debug for IfUnmodifiedSince
impl Ord for IfUnmodifiedSince
impl Ord for IfUnmodifiedSince
impl PartialEq<IfUnmodifiedSince> for IfUnmodifiedSince
impl PartialEq<IfUnmodifiedSince> for IfUnmodifiedSince
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 ==
. Read more
fn ne(&self, other: &IfUnmodifiedSince) -> bool
fn ne(&self, other: &IfUnmodifiedSince) -> bool
This method tests for !=
.
impl PartialOrd<IfUnmodifiedSince> for IfUnmodifiedSince
impl PartialOrd<IfUnmodifiedSince> for IfUnmodifiedSince
fn partial_cmp(&self, other: &IfUnmodifiedSince) -> Option<Ordering>
fn partial_cmp(&self, other: &IfUnmodifiedSince) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
impl ToHeaderValues for IfUnmodifiedSince
impl ToHeaderValues for IfUnmodifiedSince
type Iter = IntoIter<HeaderValue>
type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
fn to_header_values(
&self
) -> Result<<IfUnmodifiedSince as ToHeaderValues>::Iter, Error>
fn to_header_values(
&self
) -> Result<<IfUnmodifiedSince as ToHeaderValues>::Iter, Error>
Converts this object to an iterator of resolved HeaderValues
.
impl Eq for IfUnmodifiedSince
impl StructuralEq for IfUnmodifiedSince
impl StructuralPartialEq for IfUnmodifiedSince
Auto Trait Implementations
impl RefUnwindSafe for IfUnmodifiedSince
impl Send for IfUnmodifiedSince
impl Sync for IfUnmodifiedSince
impl Unpin for IfUnmodifiedSince
impl UnwindSafe for IfUnmodifiedSince
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more