pub struct RateLimitInfo {
pub limit: usize,
pub remaining: usize,
pub reset: i64,
}
Expand description
Rate limit information from the server
Fields§
§limit: usize
Maximum requests allowed per window
remaining: usize
Requests remaining in current window
reset: i64
Unix timestamp when the rate limit resets
Implementations§
Source§impl RateLimitInfo
impl RateLimitInfo
Sourcepub fn is_near_limit(&self) -> bool
pub fn is_near_limit(&self) -> bool
Check if the rate limit is close to being exceeded
Returns true if remaining requests are less than 10% of the limit
Sourcepub fn is_exceeded(&self) -> bool
pub fn is_exceeded(&self) -> bool
Check if the rate limit has been exceeded
Sourcepub fn remaining_percentage(&self) -> f64
pub fn remaining_percentage(&self) -> f64
Get the percentage of requests remaining
Trait Implementations§
Source§impl Clone for RateLimitInfo
impl Clone for RateLimitInfo
Source§fn clone(&self) -> RateLimitInfo
fn clone(&self) -> RateLimitInfo
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 RateLimitInfo
impl Debug for RateLimitInfo
Source§impl PartialEq for RateLimitInfo
impl PartialEq for RateLimitInfo
impl Copy for RateLimitInfo
impl Eq for RateLimitInfo
impl StructuralPartialEq for RateLimitInfo
Auto Trait Implementations§
impl Freeze for RateLimitInfo
impl RefUnwindSafe for RateLimitInfo
impl Send for RateLimitInfo
impl Sync for RateLimitInfo
impl Unpin for RateLimitInfo
impl UnwindSafe for RateLimitInfo
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