[−][src]Struct tryhard::RetryFutureConfig
Configuration describing how to retry a future.
This is useful if you have many futures you want to retry in the same way.
Implementations
impl RetryFutureConfig<NoBackoff, NoOnRetry>
[src]
pub fn new(max_retries: u32) -> Self
[src]
Create a new configuration with a max number of retries and no backoff strategy.
impl<BackoffT, OnRetryT> RetryFutureConfig<BackoffT, OnRetryT>
[src]
pub fn max_delay(self, delay: Duration) -> Self
[src]
Set the max duration to sleep between each attempt.
pub fn no_backoff(self) -> RetryFutureConfig<NoBackoff, OnRetryT>
[src]
Remove the backoff strategy.
This will make the future be retried immediately without any delay in between attempts.
pub fn exponential_backoff(
self,
initial_delay: Duration
) -> RetryFutureConfig<ExponentialBackoff, OnRetryT>
[src]
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.
pub fn fixed_backoff(
self,
delay: Duration
) -> RetryFutureConfig<FixedBackoff, OnRetryT>
[src]
self,
delay: Duration
) -> RetryFutureConfig<FixedBackoff, OnRetryT>
Use a fixed backoff for retrying the future.
The delay between attempts will always be delay
.
pub fn linear_backoff(
self,
delay: Duration
) -> RetryFutureConfig<LinearBackoff, OnRetryT>
[src]
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.
pub fn custom_backoff<F, R, E>(
self,
f: F
) -> RetryFutureConfig<CustomBackoffStrategy<F>, OnRetryT> where
F: FnMut(u32, &E) -> R,
R: Into<RetryPolicy>,
[src]
self,
f: F
) -> RetryFutureConfig<CustomBackoffStrategy<F>, OnRetryT> where
F: FnMut(u32, &E) -> R,
R: Into<RetryPolicy>,
Use a custom backoff specified by some function.
See RetryFuture::custom_backoff
for more details.
pub fn on_retry<F, OnRetryFuture, E>(
self,
f: F
) -> RetryFutureConfig<BackoffT, F> where
F: FnMut(u32, Option<Duration>, &E) -> OnRetryFuture,
OnRetryFuture: Future + Send + 'static,
OnRetryFuture::Output: Send + 'static,
[src]
self,
f: F
) -> RetryFutureConfig<BackoffT, F> where
F: FnMut(u32, Option<Duration>, &E) -> OnRetryFuture,
OnRetryFuture: Future + Send + 'static,
OnRetryFuture::Output: Send + 'static,
Some async computation that will be spawned before each retry.
See RetryFuture::on_retry
for more details.
Trait Implementations
impl<BackoffT: Clone, OnRetryT: Clone> Clone for RetryFutureConfig<BackoffT, OnRetryT>
[src]
pub fn clone(&self) -> RetryFutureConfig<BackoffT, OnRetryT>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<BackoffT: Copy, OnRetryT: Copy> Copy for RetryFutureConfig<BackoffT, OnRetryT>
[src]
impl<BackoffT, OnRetryT> Debug for RetryFutureConfig<BackoffT, OnRetryT> where
BackoffT: Debug,
[src]
BackoffT: Debug,
impl<BackoffT: Eq, OnRetryT: Eq> Eq for RetryFutureConfig<BackoffT, OnRetryT>
[src]
impl<BackoffT: PartialEq, OnRetryT: PartialEq> PartialEq<RetryFutureConfig<BackoffT, OnRetryT>> for RetryFutureConfig<BackoffT, OnRetryT>
[src]
pub fn eq(&self, other: &RetryFutureConfig<BackoffT, OnRetryT>) -> bool
[src]
pub fn ne(&self, other: &RetryFutureConfig<BackoffT, OnRetryT>) -> bool
[src]
impl<BackoffT, OnRetryT> StructuralEq for RetryFutureConfig<BackoffT, OnRetryT>
[src]
impl<BackoffT, OnRetryT> StructuralPartialEq for RetryFutureConfig<BackoffT, OnRetryT>
[src]
Auto Trait Implementations
impl<BackoffT, OnRetryT> RefUnwindSafe for RetryFutureConfig<BackoffT, OnRetryT> where
BackoffT: RefUnwindSafe,
OnRetryT: RefUnwindSafe,
[src]
BackoffT: RefUnwindSafe,
OnRetryT: RefUnwindSafe,
impl<BackoffT, OnRetryT> Send for RetryFutureConfig<BackoffT, OnRetryT> where
BackoffT: Send,
OnRetryT: Send,
[src]
BackoffT: Send,
OnRetryT: Send,
impl<BackoffT, OnRetryT> Sync for RetryFutureConfig<BackoffT, OnRetryT> where
BackoffT: Sync,
OnRetryT: Sync,
[src]
BackoffT: Sync,
OnRetryT: Sync,
impl<BackoffT, OnRetryT> Unpin for RetryFutureConfig<BackoffT, OnRetryT> where
BackoffT: Unpin,
OnRetryT: Unpin,
[src]
BackoffT: Unpin,
OnRetryT: Unpin,
impl<BackoffT, OnRetryT> UnwindSafe for RetryFutureConfig<BackoffT, OnRetryT> where
BackoffT: UnwindSafe,
OnRetryT: UnwindSafe,
[src]
BackoffT: UnwindSafe,
OnRetryT: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,