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

#170 in Date and time

Download history 505/week @ 2024-08-03 311/week @ 2024-08-10 290/week @ 2024-08-17 284/week @ 2024-08-24 304/week @ 2024-08-31 521/week @ 2024-09-07 220/week @ 2024-09-14 207/week @ 2024-09-21 387/week @ 2024-09-28 119/week @ 2024-10-05 235/week @ 2024-10-12 299/week @ 2024-10-19 459/week @ 2024-10-26 319/week @ 2024-11-02 443/week @ 2024-11-09 537/week @ 2024-11-16

1,767 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
~43K SLoC