use crate::compat::Duration;
use core::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum StopReason {
Succeeded,
Rejected,
Exhausted,
}
impl fmt::Display for StopReason {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
StopReason::Succeeded => f.write_str("succeeded"),
StopReason::Rejected => f.write_str("rejected"),
StopReason::Exhausted => f.write_str("retries exhausted"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct RetryStats {
pub attempts: u32,
pub total_elapsed: Option<Duration>,
pub total_wait: Duration,
pub stop_reason: StopReason,
}