touch_ratelimit 0.1.0

A composable, extensible rate limiting crate for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::errors::RateLimitExceeded;

/// Errors produced by the rate limiting middleware.
///
/// This error type wraps:
/// - errors returned by the inner service
/// - rate limit rejections
#[derive(Debug)]
pub enum RateLimitError<E> {
    /// Error returned by the wrapped service
    Inner(E),

    /// Request was rejected due to exceeding the rate limit
    Rejected(RateLimitExceeded),
}