rusty-rl 0.1.2

simple ratelimit
Documentation
use std::{
    collections::HashMap,
    time::{Duration, Instant},
};
// mod bucket;
mod fixed;
// mod fixed_bucket;

///
///

/// fixed bucket
///
/// ```
///     let b = FixedBucket::new(600, 10).bucket(90, 10.0)
/// ```
///
/// ```
///     b.allow(unique value) // boolean
/// ```

#[derive(Clone)]
pub struct FixedLimit {
    maximum_request: usize,
    duration: Duration,
    requests: HashMap<String, (usize, Instant)>,
}

pub struct Selfb {
    pub remaning_count: u64,
    pub is_allowed: bool,
    pub route: String,
}

// pub struct TokenBucket {
//     capacity: u64,
//     rates: f64,
//     last_update: HashMap<String, (f64, Instant)>,
// }

// pub struct FixedBucket {
//     request: u64,
//     duration: Duration,
//     capacity: u64,
//     rates: f64,
//     last_update: HashMap<String, (f64, Instant)>,
//     requests: HashMap<String, (u64, Instant)>,
// }