pub trait Backoff: Send + Sync + 'static {
fn next_backoff(&self) -> impl Future<Output = bool> + Send + '_;
fn reset(&self) -> impl Future<Output = ()> + Send + '_;
}
impl Backoff for () {
async fn next_backoff(&self) -> bool {
false
}
async fn reset(&self) {}
}
impl<T: Backoff> Backoff for Option<T> {
async fn next_backoff(&self) -> bool {
false
}
async fn reset(&self) {}
}
impl<T: Backoff> Backoff for std::sync::Arc<T> {
#[inline]
fn next_backoff(&self) -> impl Future<Output = bool> + Send + '_ {
(**self).next_backoff()
}
fn reset(&self) -> impl Future<Output = ()> + Send + '_ {
(**self).reset()
}
}
mod exponential;
#[doc(inline)]
pub use exponential::ExponentialBackoff;