pub struct RetryFutureConfig<BackoffT, OnRetryT> { /* private fields */ }
Expand description
Configuration describing how to retry a future.
This is useful if you have many futures you want to retry in the same way.
Implementations§
source§impl<BackoffT, OnRetryT> RetryFutureConfig<BackoffT, OnRetryT>
impl<BackoffT, OnRetryT> RetryFutureConfig<BackoffT, OnRetryT>
sourcepub fn max_delay(self, delay: Duration) -> Self
pub fn max_delay(self, delay: Duration) -> Self
Set the max duration to sleep between each attempt.
sourcepub fn no_backoff(self) -> RetryFutureConfig<NoBackoff, OnRetryT>
pub fn no_backoff(self) -> RetryFutureConfig<NoBackoff, OnRetryT>
Remove the backoff strategy.
This will make the future be retried immediately without any delay in between attempts.
sourcepub fn exponential_backoff(
self,
initial_delay: Duration,
) -> RetryFutureConfig<ExponentialBackoff, OnRetryT>
pub fn exponential_backoff( self, initial_delay: Duration, ) -> RetryFutureConfig<ExponentialBackoff, OnRetryT>
Use exponential backoff for retrying the future.
The first delay will be initial_delay
and afterwards the delay will double every time.
sourcepub fn fixed_backoff(
self,
delay: Duration,
) -> RetryFutureConfig<FixedBackoff, OnRetryT>
pub fn fixed_backoff( self, delay: Duration, ) -> RetryFutureConfig<FixedBackoff, OnRetryT>
Use a fixed backoff for retrying the future.
The delay between attempts will always be delay
.
sourcepub fn linear_backoff(
self,
delay: Duration,
) -> RetryFutureConfig<LinearBackoff, OnRetryT>
pub fn linear_backoff( self, delay: Duration, ) -> RetryFutureConfig<LinearBackoff, OnRetryT>
Use a linear backoff for retrying the future.
The delay will be delay * attempt
so it’ll scale linear with the attempt.
sourcepub fn custom_backoff<B>(
self,
backoff_strategy: B,
) -> RetryFutureConfig<B, OnRetryT>
pub fn custom_backoff<B>( self, backoff_strategy: B, ) -> RetryFutureConfig<B, OnRetryT>
Use a custom backoff specified by some function.
See RetryFuture::custom_backoff
for more details.
sourcepub fn on_retry<F>(self, f: F) -> RetryFutureConfig<BackoffT, F>
pub fn on_retry<F>(self, f: F) -> RetryFutureConfig<BackoffT, F>
Some async computation that will be spawned before each retry.
See RetryFuture::on_retry
for more details.
Trait Implementations§
source§impl<BackoffT: Clone, OnRetryT: Clone> Clone for RetryFutureConfig<BackoffT, OnRetryT>
impl<BackoffT: Clone, OnRetryT: Clone> Clone for RetryFutureConfig<BackoffT, OnRetryT>
source§fn clone(&self) -> RetryFutureConfig<BackoffT, OnRetryT>
fn clone(&self) -> RetryFutureConfig<BackoffT, OnRetryT>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<BackoffT, OnRetryT> Debug for RetryFutureConfig<BackoffT, OnRetryT>where
BackoffT: Debug,
impl<BackoffT, OnRetryT> Debug for RetryFutureConfig<BackoffT, OnRetryT>where
BackoffT: Debug,
source§impl<BackoffT: PartialEq, OnRetryT: PartialEq> PartialEq for RetryFutureConfig<BackoffT, OnRetryT>
impl<BackoffT: PartialEq, OnRetryT: PartialEq> PartialEq for RetryFutureConfig<BackoffT, OnRetryT>
source§fn eq(&self, other: &RetryFutureConfig<BackoffT, OnRetryT>) -> bool
fn eq(&self, other: &RetryFutureConfig<BackoffT, OnRetryT>) -> bool
self
and other
values to be equal, and is used by ==
.impl<BackoffT: Copy, OnRetryT: Copy> Copy for RetryFutureConfig<BackoffT, OnRetryT>
impl<BackoffT: Eq, OnRetryT: Eq> Eq for RetryFutureConfig<BackoffT, OnRetryT>
impl<BackoffT, OnRetryT> StructuralPartialEq for RetryFutureConfig<BackoffT, OnRetryT>
Auto Trait Implementations§
impl<BackoffT, OnRetryT> Freeze for RetryFutureConfig<BackoffT, OnRetryT>
impl<BackoffT, OnRetryT> RefUnwindSafe for RetryFutureConfig<BackoffT, OnRetryT>where
BackoffT: RefUnwindSafe,
OnRetryT: RefUnwindSafe,
impl<BackoffT, OnRetryT> Send for RetryFutureConfig<BackoffT, OnRetryT>
impl<BackoffT, OnRetryT> Sync for RetryFutureConfig<BackoffT, OnRetryT>
impl<BackoffT, OnRetryT> Unpin for RetryFutureConfig<BackoffT, OnRetryT>
impl<BackoffT, OnRetryT> UnwindSafe for RetryFutureConfig<BackoffT, OnRetryT>where
BackoffT: UnwindSafe,
OnRetryT: UnwindSafe,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)