pub struct RateLimitInfo {
pub remaining: Option<u32>,
pub limit: Option<u32>,
pub retry_after: Option<u64>,
}Expand description
Rate limit information from API response headers.
Fields§
§remaining: Option<u32>Number of requests remaining in the current window.
limit: Option<u32>Total request limit for the current window.
retry_after: Option<u64>Seconds until the rate limit resets.
Implementations§
Source§impl RateLimitInfo
impl RateLimitInfo
Sourcepub fn new() -> RateLimitInfo
pub fn new() -> RateLimitInfo
Creates a new rate limit info.
Sourcepub fn with_remaining(self, remaining: u32) -> RateLimitInfo
pub fn with_remaining(self, remaining: u32) -> RateLimitInfo
Sets the remaining requests.
Sourcepub fn with_limit(self, limit: u32) -> RateLimitInfo
pub fn with_limit(self, limit: u32) -> RateLimitInfo
Sets the limit.
Sourcepub fn with_retry_after(self, seconds: u64) -> RateLimitInfo
pub fn with_retry_after(self, seconds: u64) -> RateLimitInfo
Sets the retry after duration in seconds.
Sourcepub fn is_limited(&self) -> bool
pub fn is_limited(&self) -> bool
Returns true if rate limited.
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 Default for RateLimitInfo
impl Default for RateLimitInfo
Source§fn default() -> RateLimitInfo
fn default() -> RateLimitInfo
Returns the “default value” for a type. Read more
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