tower-rate-tier 0.2.0

Tier-based rate limiting middleware for Tower
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use http::StatusCode;

/// Behavior when the identifier cannot determine the user/tier.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub enum OnMissing {
    /// Use the default tier's quota.
    #[default]
    UseDefault,
    /// Allow the request through without rate limiting.
    Allow,
    /// Deny the request with the given status code.
    Deny(StatusCode),
}