From afe6b6ea96bb1fbd3dceacc9ec9812c011899c80 Mon Sep 17 00:00:00 2001 From: Marcelo Altmann Date: Wed, 3 Sep 2025 16:50:10 -0300 Subject: [PATCH] Expose disconnected state of the connection This commit exposes the disconnected state of the connection. The state is useful for checking if the connection is still alive or if we need to reconnect. --- src/conn/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/conn/mod.rs b/src/conn/mod.rs index 9188941..741e7a8 100644 --- a/src/conn/mod.rs +++ b/src/conn/mod.rs @@ -196,6 +196,11 @@ impl Conn { self.inner.id } + /// Returns the disconnected state of the connection. + pub fn is_disconnected(&self) -> bool { + self.inner.disconnected + } + /// Returns the ID generated by a query (usually `INSERT`) on a table with a column having the /// `AUTO_INCREMENT` attribute. Returns `None` if there was no previous query on the connection /// or if the query did not update an AUTO_INCREMENT value.