pub struct Ratelimit { /* private fields */ }
Expand description
A set of data containing information about the ratelimits for a particular
RatelimitingBucket
, which is stored in Http
.
See the Discord docs on ratelimits for more information.
Note: You should not mutate any of the fields, as this can help cause 429s.
Implementations§
Source§impl Ratelimit
impl Ratelimit
pub async fn pre_hook( &mut self, req: &Request<'_>, ratelimit_callback: &(dyn Fn(RatelimitInfo) + Send + Sync), )
pub async fn post_hook( &mut self, response: &Response, req: &Request<'_>, ratelimit_callback: &(dyn Fn(RatelimitInfo) + Send + Sync), absolute_ratelimits: bool, ) -> Result<bool>
Sourcepub const fn limit(&self) -> i64
pub const fn limit(&self) -> i64
The total number of requests that can be made in a period of time.
Sourcepub const fn reset(&self) -> Option<SystemTime>
pub const fn reset(&self) -> Option<SystemTime>
The absolute time in milliseconds when the interval resets.
Sourcepub const fn reset_after(&self) -> Option<Duration>
pub const fn reset_after(&self) -> Option<Duration>
The total time in milliseconds when the interval resets.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ratelimit
impl RefUnwindSafe for Ratelimit
impl Send for Ratelimit
impl Sync for Ratelimit
impl Unpin for Ratelimit
impl UnwindSafe for Ratelimit
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