/// Good for rate-limiting certain things. #[derive(Default)] pub struct Governor { last: f64, } impl Governor { /// Is the rate limit ready to allow another action? pub fn ready(&mut self, time: f64, limit: f64) -> bool { if time > self.last + limit { self.last = time; true } else { false } } }