From 4011671a779fce3ff083260a046f222d86f917fd Mon Sep 17 00:00:00 2001 From: Chip Senkbeil Date: Fri, 19 Aug 2022 01:42:01 -0500 Subject: [PATCH] Add SshFamily::as_static_str for logging purposes --- distant-ssh2/src/lib.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/distant-ssh2/src/lib.rs b/distant-ssh2/src/lib.rs index dbdf2ec..2c66011 100644 --- a/distant-ssh2/src/lib.rs +++ b/distant-ssh2/src/lib.rs @@ -44,6 +44,15 @@ pub enum SshFamily { Windows, } +impl SshFamily { + pub const fn as_static_str(&self) -> &'static str { + match self { + Self::Unix => "unix", + Self::Windows => "windows", + } + } +} + /// Represents the backend to use for ssh operations #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -59,7 +68,7 @@ pub enum SshBackend { } impl SshBackend { - pub fn as_static_str(&self) -> &'static str { + pub const fn as_static_str(&self) -> &'static str { match self { #[cfg(feature = "libssh")] Self::LibSsh => "libssh", @@ -587,6 +596,7 @@ impl Ssh { } let family = self.detect_family().await?; + trace!("Detected family: {}", family.as_static_str()); let host = self.host().to_string();