feat(client): Implement Debug for Client
Protocol doesn't extend Debug so we have to leave that out of the output unfortunately.
This commit is contained in:
		| @@ -58,6 +58,7 @@ | ||||
| use std::default::Default; | ||||
| use std::io::{self, copy, Read}; | ||||
| use std::iter::Extend; | ||||
| use std::fmt; | ||||
|  | ||||
| use std::time::Duration; | ||||
|  | ||||
| @@ -92,6 +93,16 @@ pub struct Client { | ||||
|     write_timeout: Option<Duration>, | ||||
| } | ||||
|  | ||||
| impl fmt::Debug for Client { | ||||
|     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
|         fmt.debug_struct("Client") | ||||
|            .field("redirect_policy", &self.redirect_policy) | ||||
|            .field("read_timeout", &self.read_timeout) | ||||
|            .field("write_timeout", &self.write_timeout) | ||||
|            .finish() | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl Client { | ||||
|  | ||||
|     /// Create a new Client. | ||||
| @@ -405,6 +416,16 @@ pub enum RedirectPolicy { | ||||
|     FollowIf(fn(&Url) -> bool), | ||||
| } | ||||
|  | ||||
| impl fmt::Debug for RedirectPolicy { | ||||
|     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
|         match *self { | ||||
|             RedirectPolicy::FollowNone => fmt.write_str("FollowNone"), | ||||
|             RedirectPolicy::FollowAll => fmt.write_str("FollowAll"), | ||||
|             RedirectPolicy::FollowIf(_) => fmt.write_str("FollowIf"), | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| // This is a hack because of upstream typesystem issues. | ||||
| impl Clone for RedirectPolicy { | ||||
|     fn clone(&self) -> RedirectPolicy { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user