antifuchs / ratelimit_meter

A leaky-bucket-as-a-meter rate-limiting implementation in Rust
MIT License
33 stars 6 forks source link

Implement actual clock sources #29

Closed antifuchs closed 4 years ago

antifuchs commented 5 years ago

I did a somewhat halfway-there implementation of timestamp sources, assuming there would be only one (a singleton or static thing, I assumed), and that the timestamps that it returns would be compatible with Duration. This is true in std, but not super true if one wanted to use quanta, especially when using its mock time sources.

So, to implement a truly usable clock source, we need to do the following: