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

#169 in Date and time

Download history 529/week @ 2024-07-29 510/week @ 2024-08-05 303/week @ 2024-08-12 294/week @ 2024-08-19 290/week @ 2024-08-26 298/week @ 2024-09-02 521/week @ 2024-09-09 219/week @ 2024-09-16 208/week @ 2024-09-23 415/week @ 2024-09-30 89/week @ 2024-10-07 236/week @ 2024-10-14 297/week @ 2024-10-21 464/week @ 2024-10-28 319/week @ 2024-11-04 453/week @ 2024-11-11

1,536 downloads per month
Used in 2 crates (via janus_collector)

MIT/Apache

9KB
121 lines

retry-after

Build Status Crates.io Version

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.7–2.5MB
~44K SLoC