pub struct RateLimit { /* private fields */ }Expand description
A structure containing information about the current speed limit for a particular key.
Implementations§
Source§impl RateLimit
impl RateLimit
Sourcepub fn get_remaining_tokens(&self) -> usize
pub fn get_remaining_tokens(&self) -> usize
Returns the number of tokens available.
Sourcepub fn get_retry_after(&self) -> DateTime<Local>
pub fn get_retry_after(&self) -> DateTime<Local>
If the tokens have run out, this method will return the time after which at least one token will be available.
Sourcepub fn is_accepted(&self) -> bool
pub fn is_accepted(&self) -> bool
Returns a result reflecting whether this request was executed within the current limit.
Sourcepub fn ensure_accepted(&self) -> Result<(), RateLimitExceededError>
pub fn ensure_accepted(&self) -> Result<(), RateLimitExceededError>
Same as Self::is_accepted(), but will return Err(RateLimitExceededError) if
the request failed within the current limit.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RateLimit
impl RefUnwindSafe for RateLimit
impl Send for RateLimit
impl Sync for RateLimit
impl Unpin 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