pub struct RateLimiter { /* private fields */ }Expand description
Rate limiting utility for controlling event processing speed.
Implementations§
Source§impl RateLimiter
impl RateLimiter
Sourcepub async fn can_process(&self) -> bool
pub async fn can_process(&self) -> bool
Check if we can process another event
Sourcepub async fn record_event(&self)
pub async fn record_event(&self)
Record that an event was processed
Sourcepub async fn wait_for_capacity(&self)
pub async fn wait_for_capacity(&self)
Wait until we can process the next event
Sourcepub async fn current_rate(&self) -> f64
pub async fn current_rate(&self) -> f64
Get current rate (events per second)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RateLimiter
impl !UnwindSafe for RateLimiter
impl Freeze for RateLimiter
impl Send for RateLimiter
impl Sync for RateLimiter
impl Unpin for RateLimiter
impl UnsafeUnpin for RateLimiter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more