pub struct RateLimitInfo {
pub limit: u64,
pub remaining: u64,
pub reset_at: DateTime<Utc>,
pub is_limited: bool,
}Expand description
Rate limit information from GitHub API.
GitHub returns rate limit info in response headers:
- X-RateLimit-Limit
- X-RateLimit-Remaining
- X-RateLimit-Reset (Unix timestamp)
See docs/spec/interfaces/rate-limiting-retry.md
Fields§
§limit: u64Maximum number of requests allowed
remaining: u64Number of requests remaining
reset_at: DateTime<Utc>Time when the rate limit resets
is_limited: boolWhether currently rate limited
Implementations§
Source§impl RateLimitInfo
impl RateLimitInfo
Sourcepub fn from_headers(
limit: Option<&str>,
remaining: Option<&str>,
reset: Option<&str>,
) -> Option<Self>
pub fn from_headers( limit: Option<&str>, remaining: Option<&str>, reset: Option<&str>, ) -> Option<Self>
Create rate limit info from response headers.
See docs/spec/interfaces/rate-limiting-retry.md
Sourcepub fn is_near_limit(&self, threshold_pct: f64) -> bool
pub fn is_near_limit(&self, threshold_pct: f64) -> bool
Check if we’re approaching the rate limit.
Returns true if remaining requests are below the threshold.
Sourcepub fn time_until_reset(&self) -> Duration
pub fn time_until_reset(&self) -> Duration
Get time until rate limit reset.
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<'de> Deserialize<'de> for RateLimitInfo
impl<'de> Deserialize<'de> for RateLimitInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. 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 UnsafeUnpin 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