pub struct RateLimit {
pub short_term_usage: u32,
pub short_term_limit: u32,
pub long_term_usage: u32,
pub long_term_limit: u32,
}Expand description
Counters from Strava’s X-RateLimit-Usage and X-RateLimit-Limit
response headers. Strava tracks two windows per application:
- short term — 15-minute rolling window
- long term — 24-hour rolling window
Strava’s default quotas are 100 (short) / 1000 (long); elevated apps get higher limits. Both counters are per-application, not per-token, so a process-wide “last seen” snapshot is an accurate view of consumption.
Fields§
§short_term_usage: u32§short_term_limit: u32§long_term_usage: u32§long_term_limit: u32Implementations§
Source§impl RateLimit
impl RateLimit
Sourcepub fn from_headers(headers: &HeaderMap) -> Option<Self>
pub fn from_headers(headers: &HeaderMap) -> Option<Self>
Parse both headers from a response. Returns None if either header
is missing or malformed (e.g. mock servers without the headers set).
Sourcepub fn short_term_remaining(&self) -> u32
pub fn short_term_remaining(&self) -> u32
Remaining calls before the 15-minute quota trips (saturating).
Sourcepub fn long_term_remaining(&self) -> u32
pub fn long_term_remaining(&self) -> u32
Remaining calls before the daily quota trips (saturating).
Trait Implementations§
impl Copy for RateLimit
impl Eq for RateLimit
impl StructuralPartialEq for RateLimit
Auto Trait Implementations§
impl Freeze for RateLimit
impl RefUnwindSafe for RateLimit
impl Send for RateLimit
impl Sync for RateLimit
impl Unpin for RateLimit
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.