pub fn new(limit: RateLimit) -> RateLimiter[src]
Create without preallocating storage. Ideal if it may go unused.
pub fn new_preallocated(limit: RateLimit) -> RateLimiter[src]
Create with preallocated storage. Ideal if you're likely to use it a lot to avoid resizing during fill.
Checks whether we're able to perform the event at this time. On success, logs the current time to count towards future enforcement.
RateLimiter::check, but you can provide an arbitrary
timestamp (useful for tests!).
Warning: do not go backwards in time, things will mess up.
impl RefUnwindSafe for RateLimiter
impl Send for RateLimiter
impl Sync for RateLimiter
impl Unpin for RateLimiter
impl UnwindSafe for RateLimiter
type Error = Infallible
The type returned in the event of a conversion error.