[−][src]Struct http_desync_guardian::ultralight_rate_limiter::UltraLightRateLimiter
An ultra light rate limiter. It allows exactly limit queries per slot of time (without handling bursts), which makes it much simpler to test, and it's good enough (to limit logging).
Implementations
impl UltraLightRateLimiter
[src]
pub fn new(limit_per_second: f64, ticker_ms: fn() -> u64) -> Self
[src]
Creates a new rate limiter based on the desired limit per second, and a clock function.
Arguments
limit_per_second
how many permits it issues per second. If greater than 1, then it's truncated
ticker_ms
a clock function with ms
precision. E.g. a MONOTONIC_CLOCK
pub fn try_acquire_value<T>(&self, value: T) -> Option<T>
[src]
pub fn try_acquire(&self) -> bool
[src]
Auto Trait Implementations
impl RefUnwindSafe for UltraLightRateLimiter
impl Send for UltraLightRateLimiter
impl Sync for UltraLightRateLimiter
impl Unpin for UltraLightRateLimiter
impl UnwindSafe for UltraLightRateLimiter
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,