Enum hyperx::header::RetryAfter[][src]

pub enum RetryAfter {
    Delay(Duration),
    DateTime(HttpDate),
}
Expand description

The Retry-After header.

The Retry-After response-header field can be used with a 503 (Service Unavailable) response to indicate how long the service is expected to be unavailable to the requesting client. This field MAY also be used with any 3xx (Redirection) response to indicate the minimum time the user-agent is asked wait before issuing the redirected request. The value of this field can be either an HTTP-date or an integer number of seconds (in decimal) after the time of the response.

Examples

use std::time::Duration;
use hyperx::header::{RetryAfter, TypedHeaders};

let mut headers = http::HeaderMap::new();
headers.encode(
    &RetryAfter::Delay(Duration::from_secs(300))
);
use std::time::{SystemTime, Duration};
use hyperx::header::{RetryAfter, TypedHeaders};

let mut headers = http::HeaderMap::new();
let date = SystemTime::now() + Duration::from_secs(300);
headers.encode(
    &RetryAfter::DateTime(date.into())
);

Retry-After header, defined in RFC7231

Variants

Delay(Duration)

Retry after this duration has elapsed

This can be coupled with a response time header to produce a DateTime.

Tuple Fields of Delay

0: Duration
DateTime(HttpDate)

Retry after the given DateTime

Tuple Fields of DateTime

0: HttpDate

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Returns the name of the header field this belongs to. Read more

Parse a header from a raw stream of bytes. Read more

Format a header to outgoing stream. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The HeaderName from the http crate for this header.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.