diff options
| author | Steven Fackler <[email protected]> | 2015-10-26 21:43:52 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2015-10-26 21:43:52 -0700 |
| commit | 1e7ff1d8a8742a1f015ea5b336297c689a5d4810 (patch) | |
| tree | f7d8aeafa44e273779471716f63c293cbbbc81a1 | |
| parent | Merge pull request #294 from alexcrichton/nonblocking-tests (diff) | |
| download | rust-openssl-1e7ff1d8a8742a1f015ea5b336297c689a5d4810.tar.xz rust-openssl-1e7ff1d8a8742a1f015ea5b336297c689a5d4810.zip | |
Better debug impls
| -rw-r--r-- | openssl/src/ssl/mod.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 62080056..a01e1d29 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -698,10 +698,11 @@ pub struct Ssl { unsafe impl Send for Ssl {} unsafe impl Sync for Ssl {} -// TODO: put useful information here impl fmt::Debug for Ssl { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - write!(fmt, "Ssl") + fmt.debug_struct("Ssl") + .field("state", &self.get_state_string_long()) + .finish() } } @@ -1179,7 +1180,10 @@ impl SslStream<net::TcpStream> { impl<S> fmt::Debug for SslStream<S> where S: fmt::Debug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - write!(fmt, "SslStream {{ stream: {:?}, ssl: {:?} }}", self.kind.stream(), self.kind.ssl()) + fmt.debug_struct("SslStream") + .field("stream", &self.kind.stream()) + .field("ssl", &self.kind.ssl()) + .finish() } } |