pub struct ClientRateLimiterBuilder { /* private fields */ }Expand description
Builder for ClientRateLimiter.
Implementations§
Source§impl ClientRateLimiterBuilder
impl ClientRateLimiterBuilder
Sourcepub fn token_refill_rate(self, token_refill_rate: f64) -> Self
pub fn token_refill_rate(self, token_refill_rate: f64) -> Self
The rate at which token are replenished.
Sourcepub fn set_token_refill_rate(
&mut self,
token_refill_rate: Option<f64>,
) -> &mut Self
pub fn set_token_refill_rate( &mut self, token_refill_rate: Option<f64>, ) -> &mut Self
The rate at which token are replenished.
Sourcepub fn maximum_bucket_capacity(self, maximum_bucket_capacity: f64) -> Self
pub fn maximum_bucket_capacity(self, maximum_bucket_capacity: f64) -> Self
The maximum capacity allowed in the token bucket
The implementation of ClientRateLimiter guarantees that current_capacity never exceeds this value.
Sourcepub fn set_maximum_bucket_capacity(
&mut self,
maximum_bucket_capacity: Option<f64>,
) -> &mut Self
pub fn set_maximum_bucket_capacity( &mut self, maximum_bucket_capacity: Option<f64>, ) -> &mut Self
The maximum capacity allowed in the token bucket
The implementation of ClientRateLimiter guarantees that current_capacity never exceeds this value.
Sourcepub fn current_bucket_capacity(self, current_bucket_capacity: f64) -> Self
pub fn current_bucket_capacity(self, current_bucket_capacity: f64) -> Self
The current capacity of the token bucket
The implementation of ClientRateLimiter guarantees that this value is always at least 1.0 when it’s enabled.
Sourcepub fn set_current_bucket_capacity(
&mut self,
current_bucket_capacity: Option<f64>,
) -> &mut Self
pub fn set_current_bucket_capacity( &mut self, current_bucket_capacity: Option<f64>, ) -> &mut Self
The current capacity of the token bucket
The implementation of ClientRateLimiter guarantees that this value is always at least 1.0 when it’s enabled.
Sourcepub fn tokens_retrieved_per_second(
self,
tokens_retrieved_per_second: f64,
) -> Self
pub fn tokens_retrieved_per_second( self, tokens_retrieved_per_second: f64, ) -> Self
The smoothed rate which tokens are being retrieved.
Sourcepub fn set_tokens_retrieved_per_second(
&mut self,
tokens_retrieved_per_second: Option<f64>,
) -> &mut Self
pub fn set_tokens_retrieved_per_second( &mut self, tokens_retrieved_per_second: Option<f64>, ) -> &mut Self
The smoothed rate which tokens are being retrieved.
Sourcepub fn build(self) -> ClientRateLimiter
pub fn build(self) -> ClientRateLimiter
Build the ClientRateLimiter.
Trait Implementations§
Source§impl Clone for ClientRateLimiterBuilder
impl Clone for ClientRateLimiterBuilder
Source§fn clone(&self) -> ClientRateLimiterBuilder
fn clone(&self) -> ClientRateLimiterBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClientRateLimiterBuilder
impl Debug for ClientRateLimiterBuilder
Source§impl Default for ClientRateLimiterBuilder
impl Default for ClientRateLimiterBuilder
Source§fn default() -> ClientRateLimiterBuilder
fn default() -> ClientRateLimiterBuilder
Auto Trait Implementations§
impl Freeze for ClientRateLimiterBuilder
impl RefUnwindSafe for ClientRateLimiterBuilder
impl Send for ClientRateLimiterBuilder
impl Sync for ClientRateLimiterBuilder
impl Unpin for ClientRateLimiterBuilder
impl UnwindSafe for ClientRateLimiterBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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