retry_backoff/
retry_backoff.rs1use core::{fmt, time::Duration};
2
3pub trait RetryBackoff {
5 fn delay(&self, attempts: usize) -> Duration;
7
8 fn name(&self) -> &str {
9 "_"
10 }
11}
12
13impl fmt::Debug for dyn RetryBackoff {
15 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16 f.debug_tuple("RetryBackoff")
17 .field(&RetryBackoff::name(self))
18 .finish()
19 }
20}
21
22impl fmt::Debug for dyn RetryBackoff + Send {
23 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24 f.debug_tuple("RetryBackoff")
25 .field(&RetryBackoff::name(self))
26 .finish()
27 }
28}
29
30impl fmt::Debug for dyn RetryBackoff + Send + Sync {
31 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32 f.debug_tuple("RetryBackoff")
33 .field(&RetryBackoff::name(self))
34 .finish()
35 }
36}