diff --git a/src/client/mod.rs b/src/client/mod.rs index 5d48fb60d0..37969092d7 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -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, } +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 {