Struct ratelimit::Ratelimit [] [src]

pub struct Ratelimit {
    // some fields omitted
}

Methods

impl Ratelimit
[src]

fn new(capacity: usize, interval: u64) -> Option<Ratelimit>

create a new ratelimit instance

Example


let mut r = Ratelimit::new(0, 1).unwrap();

fn run(&mut self)

this should be run in a tight-loop in its own thread

fn clone_sender(&mut self) -> SyncSender<()>

give a sender for client to use