pub trait IsRetryable {
fn is_retryable(&self) -> bool;
}
impl IsRetryable for std::io::Error {
fn is_retryable(&self) -> bool {
matches!(
self.kind(),
std::io::ErrorKind::ConnectionRefused
| std::io::ErrorKind::ConnectionReset
| std::io::ErrorKind::ConnectionAborted
| std::io::ErrorKind::TimedOut
| std::io::ErrorKind::WouldBlock
| std::io::ErrorKind::BrokenPipe
)
}
}
impl IsRetryable for std::net::AddrParseError {
fn is_retryable(&self) -> bool {
false
}
}