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

#513 in Network programming

Download history 472/week @ 2024-02-20 404/week @ 2024-02-27 707/week @ 2024-03-05 949/week @ 2024-03-12 1110/week @ 2024-03-19 831/week @ 2024-03-26 875/week @ 2024-04-02 684/week @ 2024-04-09 446/week @ 2024-04-16 343/week @ 2024-04-23 679/week @ 2024-04-30 248/week @ 2024-05-07 590/week @ 2024-05-14 274/week @ 2024-05-21 505/week @ 2024-05-28 506/week @ 2024-06-04

1,958 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.6MB
~46K SLoC