5 releases (3 breaking)
0.4.0 | Mar 14, 2024 |
---|---|
0.3.1 | Oct 1, 2021 |
0.3.0 | Oct 1, 2021 |
0.2.0 | Jul 21, 2016 |
0.1.0 | Mar 29, 2016 |
#151 in Date and time
1,260 downloads per month
Used in 2 crates
(via janus_collector)
9KB
121 lines
retry-after
Retry-After header for Hyper. Implemented according to RFC7231-7.1.3.
Usage
For more in-depth examples, please see the examples directory.
extern crate chrono;
extern crate retry_after;
use chrono::{Duration, UTC};
use retry_after::RetryAfter;
fn main() {
// Create a RetryAfter::Delay header
let retry_after_delay = RetryAfter::Delay(Duration::seconds(300));
// Create a RetryAfter::DateTime header
let retry_after_dt = RetryAfter::DateTime(UTC::now() + Duration::seconds(300));
}
lib.rs
:
A Retry-After
header implementation for Hyper
This crate's repo is located at https://github.com/jwilm/retry-after.
Examples
use std::time::{Duration, SystemTime};
use retry_after::RetryAfter;
// Create a RetryAfter::Delay header
let retry_after_delay = RetryAfter::Delay(Duration::from_secs(300));
// Create a RetryAfter::DateTime header
let retry_after_dt = RetryAfter::DateTime(SystemTime::now() + Duration::from_secs(300));
For more examples, please see the examples directory at the crate root.
Dependencies
~1.8–2.5MB
~45K SLoC