pub struct RateLimitSnapshot {
pub limit: u64,
pub remaining: u64,
pub used: Option<u64>,
pub reset_unix_secs: u64,
pub observed_at: Timestamp,
}Expand description
What GitHub said about the account’s hourly quota on one response.
Fields§
§limit: u64x-ratelimit-limit.
remaining: u64x-ratelimit-remaining.
used: Option<u64>x-ratelimit-used, when sent.
reset_unix_secs: u64x-ratelimit-reset, a Unix timestamp in seconds.
observed_at: TimestampWhen this host read it.
Implementations§
Source§impl RateLimitSnapshot
impl RateLimitSnapshot
Sourcepub fn from_headers(headers: &HeaderMap, now: Timestamp) -> Option<Self>
pub fn from_headers(headers: &HeaderMap, now: Timestamp) -> Option<Self>
The core quota’s state from a response’s headers, or None when the
response did not carry all three of limit, remaining and reset, or
described a different resource (search, graphql, …), whose bucket
is not the one demand polling spends.
Sourcepub fn reset_in(&self, now: Timestamp) -> Duration
pub fn reset_in(&self, now: Timestamp) -> Duration
How long until the quota resets, zero once it has.
Sourcepub fn pressure(&self, now: Timestamp) -> PrimaryPressure
pub fn pressure(&self, now: Timestamp) -> PrimaryPressure
How hard this reading says to slow down.
A reading whose reset has passed says nothing about the current window,
so it is PrimaryPressure::Normal however low it was.
Trait Implementations§
Source§impl Clone for RateLimitSnapshot
impl Clone for RateLimitSnapshot
impl Copy for RateLimitSnapshot
Source§impl Debug for RateLimitSnapshot
impl Debug for RateLimitSnapshot
Source§impl<'de> Deserialize<'de> for RateLimitSnapshot
impl<'de> Deserialize<'de> for RateLimitSnapshot
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
impl Eq for RateLimitSnapshot
Source§impl PartialEq for RateLimitSnapshot
impl PartialEq for RateLimitSnapshot
Source§impl Serialize for RateLimitSnapshot
impl Serialize for RateLimitSnapshot
impl StructuralPartialEq for RateLimitSnapshot
Auto Trait Implementations§
impl Freeze for RateLimitSnapshot
impl RefUnwindSafe for RateLimitSnapshot
impl Send for RateLimitSnapshot
impl Sync for RateLimitSnapshot
impl Unpin for RateLimitSnapshot
impl UnsafeUnpin for RateLimitSnapshot
impl UnwindSafe for RateLimitSnapshot
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.