Struct ratelimit::Config
[−]
[src]
pub struct Config { // some fields omitted }
Methods
impl Config
[src]
fn build(self) -> Ratelimit
fn quantum(self, quantum: u32) -> Self
sets the number of tokens to add per interval
Example
let mut r = Ratelimit::configure() .quantum(100) .build();
fn capacity(self, capacity: u32) -> Self
fn interval(self, interval: Duration) -> Self
set the duration between token adds
Example
let mut r = Ratelimit::configure() .interval(Duration::new(2, 0)) .build();
fn frequency(self, cycles: u32) -> Self
set the frequency in Hz of the ratelimiter
Example
let mut rate = 100_000; // 100kHz let mut r = Ratelimit::configure() .frequency(rate) .build();