pub struct RetryAfter { /* private fields */ }
Expand description
A monotonic expiration marker for RateLimit
s.
RetryAfter
marks an instant at which a rate limit expires, which is indicated by expired
. It
can convert into the remaining time until expiration.
Implementations§
source§impl RetryAfter
impl RetryAfter
sourcepub fn remaining_at(self, at: Instant) -> Option<Duration>
pub fn remaining_at(self, at: Instant) -> Option<Duration>
Returns the remaining duration until the rate limit expires using the passed instant as the reference point.
sourcepub fn remaining(self) -> Option<Duration>
pub fn remaining(self) -> Option<Duration>
Returns the remaining duration until the rate limit expires.
sourcepub fn remaining_seconds_at(self, at: Instant) -> u64
pub fn remaining_seconds_at(self, at: Instant) -> u64
Returns the remaining seconds until the rate limit expires using the passed instant as the reference point.
This is a shortcut to retry_after.remaining().as_secs()
with one exception: If the rate
limit has expired, this function returns 0
.
sourcepub fn remaining_seconds(self) -> u64
pub fn remaining_seconds(self) -> u64
Returns the remaining seconds until the rate limit expires.
sourcepub fn expired_at(self, at: Instant) -> bool
pub fn expired_at(self, at: Instant) -> bool
Returns whether this rate limit has expired at the passed instant.
Trait Implementations§
source§impl Clone for RetryAfter
impl Clone for RetryAfter
source§fn clone(&self) -> RetryAfter
fn clone(&self) -> RetryAfter
Returns a copy 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 RetryAfter
impl Debug for RetryAfter
source§impl FromStr for RetryAfter
impl FromStr for RetryAfter
source§impl Hash for RetryAfter
impl Hash for RetryAfter
source§impl Ord for RetryAfter
impl Ord for RetryAfter
source§fn cmp(&self, other: &RetryAfter) -> Ordering
fn cmp(&self, other: &RetryAfter) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for RetryAfter
impl PartialEq for RetryAfter
source§impl PartialOrd for RetryAfter
impl PartialOrd for RetryAfter
impl Copy for RetryAfter
impl Eq for RetryAfter
impl StructuralPartialEq for RetryAfter
Auto Trait Implementations§
impl Freeze for RetryAfter
impl RefUnwindSafe for RetryAfter
impl Send for RetryAfter
impl Sync for RetryAfter
impl Unpin for RetryAfter
impl UnwindSafe for RetryAfter
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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.§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
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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