diff --git a/src/request.rs b/src/request.rs index 7b7c483..cd32b23 100644 --- a/src/request.rs +++ b/src/request.rs @@ -164,7 +164,6 @@ pub struct Request { /// /// 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`. diff --git a/src/response.rs b/src/response.rs index 8e60ac3..183e2f6 100644 --- a/src/response.rs +++ b/src/response.rs @@ -191,7 +191,6 @@ pub struct Response { /// /// 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`.