Merge pull request #105 from carllerche/custom-debug-parts

customize Debug for request/response Parts
This commit is contained in:
Alex Crichton
2017-08-08 12:52:34 +08:00
committed by GitHub
2 changed files with 25 additions and 2 deletions
+13 -1
View File
@@ -164,7 +164,6 @@ pub struct Request<T> {
///
/// The HTTP request head consists of a method, uri, version, and a set of
/// header fields.
#[derive(Debug)]
pub struct Parts {
/// The request's method
pub method: Method,
@@ -486,6 +485,19 @@ impl Parts {
}
}
impl fmt::Debug for Parts {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Parts")
.field("method", &self.method)
.field("uri", &self.uri)
.field("version", &self.version)
.field("headers", &self.headers)
// omits Extensions because not useful
// omits _priv because not useful
.finish()
}
}
impl Builder {
/// Creates a new default instance of `Builder` to construct either a
/// `Head` or a `Request`.
+12 -1
View File
@@ -191,7 +191,6 @@ pub struct Response<T> {
///
/// The HTTP response head consists of a status, version, and a set of
/// header fields.
#[derive(Debug)]
pub struct Parts {
/// The response's status
pub status: StatusCode,
@@ -481,6 +480,18 @@ impl Parts {
}
}
impl fmt::Debug for Parts {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Parts")
.field("status", &self.status)
.field("version", &self.version)
.field("headers", &self.headers)
// omits Extensions because not useful
// omits _priv because not useful
.finish()
}
}
impl Builder {
/// Creates a new default instance of `Builder` to construct either a
/// `Head` or a `Response`.