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

Download history 883/week @ 2024-06-09 620/week @ 2024-06-16 462/week @ 2024-06-23 293/week @ 2024-06-30 524/week @ 2024-07-07 394/week @ 2024-07-14 538/week @ 2024-07-21 573/week @ 2024-07-28 506/week @ 2024-08-04 306/week @ 2024-08-11 293/week @ 2024-08-18 290/week @ 2024-08-25 297/week @ 2024-09-01 522/week @ 2024-09-08 221/week @ 2024-09-15 210/week @ 2024-09-22

1,260 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.8–2.5MB
~45K SLoC