Skip to content

Commit d624b0e

Browse files
committed
Implement std::fmt::Debug for all public types
1 parent 37800f8 commit d624b0e

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

src/body.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use std::io::Read;
22
use std::fs::File;
3+
use std::fmt;
34

45
/// Body type for a request.
6+
#[derive(Debug)]
57
pub struct Body {
68
reader: Kind,
79
}
@@ -71,6 +73,15 @@ impl From<File> for Body {
7173
}
7274
}
7375

76+
impl fmt::Debug for Kind {
77+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
78+
match self {
79+
&Kind::Reader(_, ref v) => f.debug_tuple("Kind::Reader").field(&"_").field(v).finish(),
80+
&Kind::Bytes(ref v) => f.debug_tuple("Kind::Bytes").field(v).finish(),
81+
}
82+
}
83+
}
84+
7485

7586
// Wraps a `std::io::Write`.
7687
//pub struct Pipe(Kind);

src/client.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ static DEFAULT_USER_AGENT: &'static str = concat!(env!("CARGO_PKG_NAME"), "/", e
2222
///
2323
/// The `Client` holds a connection pool internally, so it is advised that
2424
/// you create one and reuse it.
25+
#[derive(Debug)]
2526
pub struct Client {
2627
inner: ::hyper::Client,
2728
}
@@ -81,6 +82,7 @@ fn new_hyper_client() -> ::Result<::hyper::Client> {
8182

8283

8384
/// A builder to construct the properties of a `Request`.
85+
#[derive(Debug)]
8486
pub struct RequestBuilder<'a> {
8587
client: &'a Client,
8688

@@ -253,6 +255,7 @@ impl<'a> RequestBuilder<'a> {
253255
}
254256

255257
/// A Response to a submitted `Request`.
258+
#[derive(Debug)]
256259
pub struct Response {
257260
inner: ::hyper::client::Response,
258261
}

src/redirect.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[derive(Debug)]
12
pub struct RedirectPolicy {
23
inner: ()
34
}

src/tls.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::io::{self, Read, Write};
22
use std::net::SocketAddr;
33
use std::time::Duration;
4+
use std::fmt;
45

56
use hyper::net::{SslClient, HttpStream, NetworkStream};
67
use native_tls::{TlsConnector, TlsStream as NativeTlsStream, HandshakeError};
@@ -34,6 +35,13 @@ impl SslClient for TlsClient {
3435
}
3536
}
3637

38+
impl fmt::Debug for TlsClient {
39+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
40+
f.debug_tuple("TlsClient").field(&"_").finish()
41+
}
42+
}
43+
44+
#[derive(Debug)]
3745
pub struct TlsStream(NativeTlsStream<HttpStream>);
3846

3947
impl Read for TlsStream {

0 commit comments

Comments
 (0)