[−][src]Struct http_types::other::RetryAfter
Indicate how long the user agent should wait before making a follow-up request.
Specifications
Examples
use http_types::other::RetryAfter; use http_types::Response; use std::time::{SystemTime, Duration}; use async_std::task; let retry = RetryAfter::new(Duration::from_secs(10)); let mut headers = Response::new(429); retry.apply(&mut headers); // Sleep for the duration, then try the task again. let retry = RetryAfter::from_headers(headers)?.unwrap(); task::sleep(retry.duration_since(SystemTime::now())?);
Implementations
impl RetryAfter[src]
pub fn new(dur: Duration) -> Self[src]
Create a new instance from a Duration.
This value will be encoded over the wire as a relative offset in seconds.
pub fn new_at(at: SystemTime) -> Self[src]
Create a new instance from a SystemTime instant.
This value will be encoded a specific Date over the wire.
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>[src]
Create a new instance from headers.
pub fn duration_since(
&self,
earlier: SystemTime
) -> Result<Duration, SystemTimeError>[src]
&self,
earlier: SystemTime
) -> Result<Duration, SystemTimeError>
Returns the amount of time elapsed from an earlier point in time.
Errors
This may return an error if the earlier time was after the current time.
pub fn apply(&self, mut 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 Clone for RetryAfter[src]
pub fn clone(&self) -> RetryAfter[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Debug for RetryAfter[src]
impl Eq for RetryAfter[src]
impl Hash for RetryAfter[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Ord for RetryAfter[src]
pub fn cmp(&self, other: &RetryAfter) -> Ordering[src]
#[must_use]pub fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self1.50.0[src]
impl PartialEq<RetryAfter> for RetryAfter[src]
pub fn eq(&self, other: &RetryAfter) -> bool[src]
pub fn ne(&self, other: &RetryAfter) -> bool[src]
impl PartialOrd<RetryAfter> for RetryAfter[src]
pub fn partial_cmp(&self, other: &RetryAfter) -> Option<Ordering>[src]
pub fn lt(&self, other: &RetryAfter) -> bool[src]
pub fn le(&self, other: &RetryAfter) -> bool[src]
pub fn gt(&self, other: &RetryAfter) -> bool[src]
pub fn ge(&self, other: &RetryAfter) -> bool[src]
impl StructuralEq for RetryAfter[src]
impl StructuralPartialEq for RetryAfter[src]
Auto Trait Implementations
impl RefUnwindSafe for RetryAfter[src]
impl Send for RetryAfter[src]
impl Sync for RetryAfter[src]
impl Unpin for RetryAfter[src]
impl UnwindSafe for RetryAfter[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,