1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Tier-based rate limiting middleware for [`tower`](https://docs.rs/tower) services.
//!
//! Assign users to named tiers (e.g. "free", "pro") with distinct quotas,
//! and let the middleware enforce limits automatically via the GCRA algorithm.
//!
//! # Features
//!
//! - `buffered-body`: identify users from the request body
//! (`TierLimitLayer::buffer_body`).
//! - `redis`: `RedisStorage` keeps the limits in Redis, shared by every
//! instance of a service. Requires Rust 1.88.
pub
/// Clock abstractions for real and deterministic (test) time sources.
/// Cost extraction: decide how many tokens each request consumes.
/// Events reported while rate limiting, for logging and metrics.
/// Background garbage collection for expired rate-limit entries.
/// Generic Cell Rate Algorithm (GCRA) implementation.
/// User identity and tier extraction from incoming requests.
/// Tower `Layer` implementation that wraps services with rate limiting.
/// Policy for handling requests whose identity cannot be resolved.
/// Policy for handling storage backend errors.
/// Policy for handling tiers that are not configured.
/// Quota definitions (rate, burst, period).
/// HTTP response helpers for rate-limit headers and 429 replies.
/// Tower `Service` implementation that enforces per-tier rate limits.
/// Storage backends for persisting rate-limit state.
/// Tier configuration and the `RateTier` builder.
/// Buffered-body variants that allow identifier access to the request body.
///
/// Requires the `buffered-body` feature.
pub use ;
pub use LimitEvent;
pub use ;
pub use ;
pub use TierLimitLayer;
pub use OnMissing;
pub use OnStorageError;
pub use OnUnknownTier;
pub use ;
pub use ;
pub use ;
pub use ;
pub use RedisStorage;