pub struct RateLimitHeaders {
pub bucket: Vec<u8>,
pub limit: u16,
pub remaining: u16,
pub reset_at: Instant,
}Expand description
Parsed user response rate limit headers.
A limit of zero marks the Bucket as exhausted until reset_at elapses.
§Global limits
Please open an issue if the RateLimiter exceeded the global limit.
§Shared limits
You may preemptively exhaust the bucket until Reset-After by completing
the Permit with RateLimitHeaders::shared, but are not required to
since these limits do not count towards the invalid request limit.
Fields§
§bucket: Vec<u8>Bucket identifier.
limit: u16Total number of requests until the bucket becomes exhausted.
remaining: u16Number of remaining requests until the bucket becomes exhausted.
reset_at: InstantTime at which the bucket resets.
Implementations§
Source§impl RateLimitHeaders
impl RateLimitHeaders
Sourcepub const REMAINING: &'static str = "x-ratelimit-remaining"
pub const REMAINING: &'static str = "x-ratelimit-remaining"
Lowercased name for the remaining header.
Sourcepub const RESET_AFTER: &'static str = "x-ratelimit-reset-after"
pub const RESET_AFTER: &'static str = "x-ratelimit-reset-after"
Lowercased name for the reset-after header.
Emulates a shared resource limit as a user limit by setting limit and
remaining to zero.
Trait Implementations§
Source§impl Clone for RateLimitHeaders
impl Clone for RateLimitHeaders
Source§fn clone(&self) -> RateLimitHeaders
fn clone(&self) -> RateLimitHeaders
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 RateLimitHeaders
impl Debug for RateLimitHeaders
Source§impl Hash for RateLimitHeaders
impl Hash for RateLimitHeaders
Source§impl PartialEq for RateLimitHeaders
impl PartialEq for RateLimitHeaders
impl Eq for RateLimitHeaders
impl StructuralPartialEq for RateLimitHeaders
Auto Trait Implementations§
impl Freeze for RateLimitHeaders
impl RefUnwindSafe for RateLimitHeaders
impl Send for RateLimitHeaders
impl Sync for RateLimitHeaders
impl Unpin for RateLimitHeaders
impl UnwindSafe for RateLimitHeaders
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.