pub struct RateLimiter { /* private fields */ }Expand description
Rate limiter for Discord API requests.
Implementations§
Source§impl RateLimiter
impl RateLimiter
Sourcepub async fn acquire(&self, route: &str) -> Result<(), HttpError>
pub async fn acquire(&self, route: &str) -> Result<(), HttpError>
Acquire permission to make a request to the given route.
Sourcepub fn update(&self, route: &str, remaining: u32, reset_after_ms: u64)
pub fn update(&self, route: &str, remaining: u32, reset_after_ms: u64)
Update rate limit info from response headers.
Sourcepub fn set_global(&self, retry_after_ms: u64)
pub fn set_global(&self, retry_after_ms: u64)
Set global rate limit.
Trait Implementations§
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