pub struct ThrottleState { /* private fields */ }Expand description
Throttling state for a domain
Implementations§
Source§impl ThrottleState
impl ThrottleState
Sourcepub fn time_until_next(&self) -> Duration
pub fn time_until_next(&self) -> Duration
Time until next allowed request
Sourcepub fn can_request_now(&self) -> bool
pub fn can_request_now(&self) -> bool
Can we make a request now?
Sourcepub fn mark_request(&mut self)
pub fn mark_request(&mut self)
Marks a request as completed
Sourcepub fn update_latency(&mut self, latency_ms: u64)
pub fn update_latency(&mut self, latency_ms: u64)
Updates the average latency
Sourcepub fn signal_rate_limit(&mut self, pause_duration: Duration)
pub fn signal_rate_limit(&mut self, pause_duration: Duration)
Signals a rate limit (429/503)
Sourcepub fn adaptive_delay(&self) -> Duration
pub fn adaptive_delay(&self) -> Duration
Adaptive delay based on latency
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ThrottleState
impl RefUnwindSafe for ThrottleState
impl Send for ThrottleState
impl Sync for ThrottleState
impl Unpin for ThrottleState
impl UnwindSafe for ThrottleState
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