pub struct RetryMiddlewareBuilder(/* private fields */);Expand description
Builder for RetryMiddleware; create via RetryMiddleware::builder.
Implementations§
Source§impl RetryMiddlewareBuilder
impl RetryMiddlewareBuilder
Sourcepub fn max_attempts(self, attempts: u32) -> Self
pub fn max_attempts(self, attempts: u32) -> Self
Set the maximum number of attempts (must be >= 1; 1 disables retry).
Sourcepub fn initial_backoff(self, dur: Duration) -> Self
pub fn initial_backoff(self, dur: Duration) -> Self
Set the initial backoff applied before the first retry.
Sourcepub fn backoff_multiplier(self, factor: f32) -> Self
pub fn backoff_multiplier(self, factor: f32) -> Self
Set the multiplier applied between successive retries.
Sourcepub fn max_backoff(self, dur: Duration) -> Self
pub fn max_backoff(self, dur: Duration) -> Self
Set the upper bound on a single backoff sleep.
Sourcepub fn jitter_ratio(self, ratio: f32) -> Self
pub fn jitter_ratio(self, ratio: f32) -> Self
Set the full-jitter ratio (clamped to [0.0, 1.0]).
0.0 (default) means deterministic backoff. 1.0 spreads each sleep
uniformly over [base/2, base*1.5]. Use a non-zero value when many
callers retry the same upstream simultaneously to avoid thundering-herd.
Sourcepub fn build(self) -> RetryMiddleware
pub fn build(self) -> RetryMiddleware
Finalize the middleware.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RetryMiddlewareBuilder
impl RefUnwindSafe for RetryMiddlewareBuilder
impl Send for RetryMiddlewareBuilder
impl Sync for RetryMiddlewareBuilder
impl Unpin for RetryMiddlewareBuilder
impl UnsafeUnpin for RetryMiddlewareBuilder
impl UnwindSafe for RetryMiddlewareBuilder
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