#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct RetryPolicy {
max_attempts: u32,
}
impl RetryPolicy {
pub fn new(max_attempts: u32) -> Self {
Self {
max_attempts: max_attempts.max(1),
}
}
pub fn max_attempts(self) -> u32 {
self.max_attempts
}
}
impl Default for RetryPolicy {
fn default() -> Self {
Self { max_attempts: 3 }
}
}