retry_predicate/
retry_predicate.rs

1use core::fmt;
2
3//
4pub trait RetryPredicate<Params> {
5    /// returns true if a retry; false otherwise
6    /// [Ref](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/function/Predicate.html#test(T))
7    fn test(&self, params: &Params) -> bool;
8
9    fn name(&self) -> &str {
10        "_"
11    }
12}
13
14//
15impl<Params> fmt::Debug for dyn RetryPredicate<Params> {
16    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17        f.debug_tuple("RetryPredicate")
18            .field(&RetryPredicate::name(self))
19            .finish()
20    }
21}
22
23impl<Params> fmt::Debug for dyn RetryPredicate<Params> + Send {
24    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25        f.debug_tuple("RetryPredicate")
26            .field(&RetryPredicate::name(self))
27            .finish()
28    }
29}
30
31impl<Params> fmt::Debug for dyn RetryPredicate<Params> + Send + Sync {
32    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
33        f.debug_tuple("RetryPredicate")
34            .field(&RetryPredicate::name(self))
35            .finish()
36    }
37}