[−][src]Trait backoff_futures::BackoffExt
Required methods
#[must_use]fn with_backoff<'life0, 'async_trait, B>(
self,
backoff: &'life0 mut B
) -> Pin<Box<dyn Future<Output = Result<T, Error<E>>> + 'async_trait>> where
B: Backoff,
T: 'async_trait,
E: 'async_trait,
Fut: 'async_trait,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
self,
backoff: &'life0 mut B
) -> Pin<Box<dyn Future<Output = Result<T, Error<E>>> + 'async_trait>> where
B: Backoff,
T: 'async_trait,
E: 'async_trait,
Fut: 'async_trait,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Use the built-in backoff::future
async support
Returns a future that, when polled, will first ask self
for a new future (with an output
type Result<T, backoff::Error<_>>
to produce the expected result.
If the underlying future is ready with an Err
value, the nature of the error
(permanent/transient) will determine whether polling the future will employ the provided
backoff
strategy and will result in the work being retried.
Specifically, backoff::Error::Permanent
errors will be returned immediately.
backoff::Error::Transient
errors will, depending on the particular backoff::backoff::Backoff
,
result in a retry attempt, most likely with a delay.
If the underlying future is ready with an std::result::Result::Ok
value, it will be returned immediately.
#[must_use]fn with_backoff_notify<'life0, 'async_trait, B, N>(
self,
backoff: &'life0 mut B,
notify: N
) -> Pin<Box<dyn Future<Output = Result<T, Error<E>>> + 'async_trait>> where
B: Backoff,
N: FnMut(&Error<E>, Duration),
T: 'async_trait,
E: 'async_trait,
Fut: 'async_trait,
B: 'async_trait,
N: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
self,
backoff: &'life0 mut B,
notify: N
) -> Pin<Box<dyn Future<Output = Result<T, Error<E>>> + 'async_trait>> where
B: Backoff,
N: FnMut(&Error<E>, Duration),
T: 'async_trait,
E: 'async_trait,
Fut: 'async_trait,
B: 'async_trait,
N: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Use the built-in backoff::future
async support
Same as BackoffExt::with_backoff
but takes an extra notify
closure that will be called every time
a new backoff is employed on transient errors. The closure takes the new delay duration as an argument.
Implementors
impl<T, E, Fut, F> BackoffExt<T, E, Fut, F> for F where
F: FnMut() -> Fut,
Fut: Future<Output = Result<T, Error<E>>>,
[src]
F: FnMut() -> Fut,
Fut: Future<Output = Result<T, Error<E>>>,
fn with_backoff<'life0, 'async_trait, B>(
self,
backoff: &'life0 mut B
) -> Pin<Box<dyn Future<Output = Result<T, Error<E>>> + 'async_trait>> where
B: Backoff,
T: 'async_trait,
E: 'async_trait,
Fut: 'async_trait,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
self,
backoff: &'life0 mut B
) -> Pin<Box<dyn Future<Output = Result<T, Error<E>>> + 'async_trait>> where
B: Backoff,
T: 'async_trait,
E: 'async_trait,
Fut: 'async_trait,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn with_backoff_notify<'life0, 'async_trait, B, N>(
self,
backoff: &'life0 mut B,
notify: N
) -> Pin<Box<dyn Future<Output = Result<T, Error<E>>> + 'async_trait>> where
B: Backoff,
N: FnMut(&Error<E>, Duration),
T: 'async_trait,
E: 'async_trait,
Fut: 'async_trait,
B: 'async_trait,
N: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
self,
backoff: &'life0 mut B,
notify: N
) -> Pin<Box<dyn Future<Output = Result<T, Error<E>>> + 'async_trait>> where
B: Backoff,
N: FnMut(&Error<E>, Duration),
T: 'async_trait,
E: 'async_trait,
Fut: 'async_trait,
B: 'async_trait,
N: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,