use std::time::{Duration, Instant};
#[allow(clippy::module_name_repetitions)]
pub trait Retryable
where
Self: Sized,
{
type FatalError;
fn to_fatal(self) -> Self::FatalError;
fn wait_time(
&self,
my_time: Instant,
previous_retriable_failures: &[(Self, Instant)],
) -> Option<Duration>;
}
#[allow(clippy::module_name_repetitions)]
#[allow(dead_code)]
pub enum RetryableResult<T, R, F>
where
R: Retryable<FatalError = F> + Sized,
T: Sized,
F: Sized,
{
GoodResult(T),
Retryable(R),
Fatal(F),
}