Skip to content

Commit

Permalink
Merge pull request #46 from cybersoulK/main
Browse files Browse the repository at this point in the history
impl Debug for Client
  • Loading branch information
Miyoshi-Ryota authored Oct 21, 2023
2 parents aab2a43 + 92a5a1c commit 1a6ee27
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use async_trait::async_trait;
use russh::client::{Config, Handle, Handler};
use std::fmt::Debug;
use std::io::{self, Write};
use std::net::SocketAddr;
use std::sync::Arc;
Expand Down Expand Up @@ -306,6 +307,16 @@ impl Client {
}
}

impl Debug for Client {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Client")
.field("username", &self.username)
.field("address", &self.address)
.field("connection_handle", &"Handle<ClientHandler>")
.finish()
}
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CommandExecutedResult {
/// The stdout output of the command.
Expand All @@ -316,7 +327,7 @@ pub struct CommandExecutedResult {
pub exit_status: u32,
}

#[derive(Clone)]
#[derive(Debug, Clone)]
struct ClientHandler {
hostname: String,
host: SocketAddr,
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ mod to_socket_addrs_with_hostname;
pub use client::{AuthMethod, Client, ServerCheckMethod};
pub use error::Error;
pub use to_socket_addrs_with_hostname::ToSocketAddrsWithHostname;

pub use russh::client::Config;

0 comments on commit 1a6ee27

Please sign in to comment.