pub struct AutoRate { /* private fields */ }Expand description
AutoRate implements an automatic throttling algorithm that limits the rate of requests based on flow control headers from the HTTP response plus a fixed random delay to avoid being predictable and too fast for the server. Inspiration ref: https://en.wikipedia.org/wiki/Leaky_bucket
Trait Implementations§
Source§impl ThrottleStrategy for AutoRate
impl ThrottleStrategy for AutoRate
Source§fn throttle(&self, flow_control_headers: Option<&FlowControlHeaders>)
fn throttle(&self, flow_control_headers: Option<&FlowControlHeaders>)
Throttle the request based on optional flow control headers.
Implementers might use the headers to adjust the throttling or ignore
them altogether. Ex. strategies could be a fixed delay, random, or based
on rate limiting headers.
Source§fn strategy(&self) -> ThrottleStrategyType
fn strategy(&self) -> ThrottleStrategyType
Return strategy type
Source§fn throttle_for(&self, delay: Milliseconds)
fn throttle_for(&self, delay: Milliseconds)
Throttle for specific amount of time.
Auto Trait Implementations§
impl Freeze for AutoRate
impl RefUnwindSafe for AutoRate
impl Send for AutoRate
impl Sync for AutoRate
impl Unpin for AutoRate
impl UnwindSafe for AutoRate
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