connection: add helper `is_ssl` method
Adds a method to ConnectionConfig which returns if the configuration is
for a SSL connection or not. This method works both with and without the
"ssl" feature enabled.
@@ -184,6 +184,18 @@ impl Default for ConnectionConfig {
}
}
+impl ConnectionConfig {
+ #[cfg(feature = "ssl")]
+ pub fn is_ssl(&self) -> bool {
+ self.ssl_context.is_some()
+ }
+
+ #[cfg(not(feature = "ssl"))]
+ pub fn is_ssl(&self) -> bool {
+ false
+ }
+}
+
// Used to listen for fatal error in connection
pub type ErrorReceiver = tokio::sync::oneshot::Receiver<QueryError>;
