Crate rateflow

Crate rateflow 

Source
Expand description

RateFlow - A declarative, flexible, and high-performance rate limiting library

This crate provides a simple yet powerful API for implementing rate limiting in your Rust applications. It supports multiple algorithms, custom strategies, and tier-based rate limiting.

§Example

use rateflow::{RateLimiter, Window};

let limiter = RateLimiter::builder()
    .limit(100)
    .window(Window::Minute)
    .build()
    .unwrap();

if limiter.check("client-id").await {
    // Process request
}

Structs§

RateLimiter
RateLimiter is the main entry point for rate limiting
RateLimiterBuilder
Builder for creating RateLimiter instances with a declarative API
Tier
Tier represents a rate limiting tier with specific limits

Enums§

RateLimitError
Errors that can occur during rate limiting operations
Strategy
Strategy defines the rate limiting algorithm to use
Window
Window defines the time period for rate limiting

Type Aliases§

Result
Result type for rate limiting operations