Skip to main content

RetryAfter

Enum RetryAfter 

Source
pub enum RetryAfter {
    Delay(Duration),
    Date {
        year: i32,
        month: u8,
        day: u8,
        hour: u8,
        minute: u8,
        second: u8,
    },
}
Expand description

A parsed Retry-After header value per RFC 9110 §10.2.3.

Servers send this header to indicate how long a user agent ought to wait before issuing a follow-up request. The grammar is

Retry-After   = HTTP-date / delay-seconds
delay-seconds = 1*DIGIT

We surface both variants — the delay-seconds form as a std::time::Duration for direct sleep-arithmetic, the HTTP-date form as the same six-tuple (year, month, day, hour, minute, second) that the §5.6.7 parsers return so the caller can compare against its own clock without dragging a date-time crate in. The driver does NOT itself wall-clock the date — interpreting “wait until this absolute time” requires a clock the source does not own.

Variants§

§

Delay(Duration)

Retry-After: <N> — delay this many seconds from receipt of the response. §10.2.3 mandates a non-negative decimal integer (1*DIGIT).

§

Date

Retry-After: <HTTP-date> — wait until this absolute UTC time. All three §5.6.7 forms are accepted on the receiver side (IMF-fixdate / rfc850-date / asctime-date), matching the MUST in §5.6.7.

Fields

§year: i32

Four-digit calendar year (1-9999, but the §5.6.7 sliding window for rfc850-date constrains real-world values to roughly REF_YEAR-49..=REF_YEAR+49).

§month: u8

Calendar month, 1-12.

§day: u8

Day of month, 1-31.

§hour: u8

Hour, 0-23.

§minute: u8

Minute, 0-59.

§second: u8

Second, 0-60 (the §5.6.7 grammar allows 60 for leap seconds; the parser does not range-check it specially).

Trait Implementations§

Source§

impl Clone for RetryAfter

Source§

fn clone(&self) -> RetryAfter

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RetryAfter

Source§

impl Debug for RetryAfter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RetryAfter

Source§

impl PartialEq for RetryAfter

Source§

fn eq(&self, other: &RetryAfter) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RetryAfter

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.