pub struct RateLimits {
pub requests: Option<Allowance>,
pub tokens: Option<Allowance>,
}Expand description
The allowances a reply’s rate-limit headers state.
Fields§
§requests: Option<Allowance>The request allowance, when the reply gave its limit and remainder.
tokens: Option<Allowance>The token allowance, when the reply gave its limit and remainder.
Implementations§
Source§impl RateLimits
impl RateLimits
Sourcepub fn from_headers(headers: &HeaderMap, now: SystemTime) -> Self
pub fn from_headers(headers: &HeaderMap, now: SystemTime) -> Self
Reads the allowances in headers, a reply that came at now.
An allowance needs both a limit and a remainder whose values start
with a whole number (100 of 100;w=60). Its reset may be seconds
(34, 1.5), a Unix time in seconds or milliseconds, a value that
starts with a Go duration (6m0s, 20ms, 1h1us), an RFC 3339 date
(2026-01-01T00:00:00Z) or an HTTP date
(Thu, 01 Jan 2026 00:00:34 GMT). A reset already past is zero; any
other form is none.
Trait Implementations§
Source§impl Clone for RateLimits
impl Clone for RateLimits
impl Copy for RateLimits
Source§impl Debug for RateLimits
impl Debug for RateLimits
Source§impl Default for RateLimits
impl Default for RateLimits
impl Eq for RateLimits
Source§impl PartialEq for RateLimits
impl PartialEq for RateLimits
impl StructuralPartialEq for RateLimits
Auto Trait Implementations§
impl Forget for RateLimits
impl Freeze for RateLimits
impl Move for RateLimits
impl RefUnwindSafe for RateLimits
impl Send for RateLimits
impl Sync for RateLimits
impl Unpin for RateLimits
impl UnsafeUnpin for RateLimits
impl UnwindSafe for RateLimits
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more