From 32166f63a8b1a0943ea6bf3c96a424608a60a97d Mon Sep 17 00:00:00 2001 From: Jakub Wieczorek Date: Mon, 29 Jan 2024 22:12:32 +0100 Subject: [PATCH] feat: Add a `Error::is_connect()` method (#95) --- src/client/legacy/client.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/client/legacy/client.rs b/src/client/legacy/client.rs index cf92d5b..6043f02 100644 --- a/src/client/legacy/client.rs +++ b/src/client/legacy/client.rs @@ -1516,6 +1516,11 @@ impl StdError for Error { } impl Error { + /// Returns true if this was an error from `Connect`. + pub fn is_connect(&self) -> bool { + matches!(self.kind, ErrorKind::Connect) + } + fn is_canceled(&self) -> bool { matches!(self.kind, ErrorKind::Canceled) }