pub struct RateLimiter { /* private fields */ }Expand description
Rate limiter for different endpoint categories
Implementations§
Source§impl RateLimiter
impl RateLimiter
Sourcepub async fn wait_for_permission(&self, category: RateLimitCategory)
pub async fn wait_for_permission(&self, category: RateLimitCategory)
Wait for rate limit permission for the given category
Sourcepub async fn check_permission(&self, category: RateLimitCategory) -> bool
pub async fn check_permission(&self, category: RateLimitCategory) -> bool
Check if permission is available without waiting
Sourcepub async fn get_tokens(&self, category: RateLimitCategory) -> u32
pub async fn get_tokens(&self, category: RateLimitCategory) -> u32
Get current token count for a category (for monitoring)
Trait Implementations§
Source§impl Clone for RateLimiter
impl Clone for RateLimiter
Source§fn clone(&self) -> RateLimiter
fn clone(&self) -> RateLimiter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RateLimiter
impl Debug for RateLimiter
Auto Trait Implementations§
impl Freeze for RateLimiter
impl !RefUnwindSafe for RateLimiter
impl Send for RateLimiter
impl Sync for RateLimiter
impl Unpin for RateLimiter
impl !UnwindSafe 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