pub enum ConnectionFailureKind {
Timeout,
Refused,
Auth,
Dns,
Transport,
Unknown,
}Expand description
Classifies the type of failure that occurred during a connection attempt.
This enum categorizes connection failures into distinct types, allowing for more targeted error handling, retry logic, and diagnostic reporting. Each variant represents a different category of connection failure that may require different handling strategies.
§Variants
-
Timeout- The connection attempt exceeded the configured timeout period. This typically indicates network latency issues, an unresponsive host, or firewall rules blocking the connection. -
Refused- The connection was actively refused by the remote host. This usually means the host is reachable but the service is not running or is not accepting connections on the specified port. -
Auth- Authentication failed during the connection attempt. This indicates that the credentials provided were invalid, expired, or insufficient for establishing the connection. -
Dns- DNS resolution failed for the hostname. This means the hostname could not be resolved to an IP address, possibly due to DNS server issues or an invalid hostname. -
Transport- A transport-layer error occurred during the connection attempt. This includes network unreachable errors, connection reset by peer, and other low-level network failures. -
Unknown- The failure type could not be determined or does not fit into any of the other categories. This is used as a fallback for unexpected or unclassified errors.
§Examples
// Create different failure kinds
let timeout = ConnectionFailureKind::Timeout;
let auth = ConnectionFailureKind::Auth;
let dns = ConnectionFailureKind::Dns;
// Use in connection status
let failed_status = ConnectionStatus::Failed(ConnectionFailureKind::Timeout);
assert!(matches!(failed_status, ConnectionStatus::Failed(_)));Variants§
Trait Implementations§
Source§impl Clone for ConnectionFailureKind
impl Clone for ConnectionFailureKind
Source§fn clone(&self) -> ConnectionFailureKind
fn clone(&self) -> ConnectionFailureKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConnectionFailureKind
impl Debug for ConnectionFailureKind
impl Eq for ConnectionFailureKind
Source§impl PartialEq for ConnectionFailureKind
impl PartialEq for ConnectionFailureKind
Source§fn eq(&self, other: &ConnectionFailureKind) -> bool
fn eq(&self, other: &ConnectionFailureKind) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ConnectionFailureKind
Auto Trait Implementations§
impl Freeze for ConnectionFailureKind
impl RefUnwindSafe for ConnectionFailureKind
impl Send for ConnectionFailureKind
impl Sync for ConnectionFailureKind
impl Unpin for ConnectionFailureKind
impl UnsafeUnpin for ConnectionFailureKind
impl UnwindSafe for ConnectionFailureKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.