1pub trait IsRetryable {
5 fn is_retryable(&self) -> bool;
7}
8
9impl IsRetryable for std::io::Error {
11 fn is_retryable(&self) -> bool {
12 matches!(
13 self.kind(),
14 std::io::ErrorKind::ConnectionRefused
15 | std::io::ErrorKind::ConnectionReset
16 | std::io::ErrorKind::ConnectionAborted
17 | std::io::ErrorKind::TimedOut
18 | std::io::ErrorKind::WouldBlock
19 | std::io::ErrorKind::BrokenPipe
20 )
21 }
22}
23
24impl IsRetryable for std::net::AddrParseError {
25 fn is_retryable(&self) -> bool {
26 false
27 }
28}