mirror of
https://github.com/openharmony/third_party_rust_http.git
synced 2026-07-19 22:53:59 -04:00
Merge pull request #105 from carllerche/custom-debug-parts
customize Debug for request/response Parts
This commit is contained in:
+13
-1
@@ -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
@@ -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`.
|
||||
|
||||
Reference in New Issue
Block a user