From aa692236a851d29abec63b6a0d61d957cea5fd26 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Thu, 19 May 2016 22:40:00 -0700 Subject: [PATCH] fix(client): Manually impl Debug for PooledStream Mutex's impl has a 'static bound on the inner type until 1.8, so we have to explicitly specify that to keep compatible. --- src/client/pool.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/client/pool.rs b/src/client/pool.rs index f3198d5bf9..357afd523f 100644 --- a/src/client/pool.rs +++ b/src/client/pool.rs @@ -1,6 +1,7 @@ //! Client Connection Pooling use std::borrow::ToOwned; use std::collections::HashMap; +use std::fmt; use std::io::{self, Read, Write}; use std::net::{SocketAddr, Shutdown}; use std::sync::{Arc, Mutex}; @@ -136,13 +137,23 @@ impl, S: NetworkStream + Send> NetworkConnector fo } /// A Stream that will try to be returned to the Pool when dropped. -#[derive(Debug)] pub struct PooledStream { inner: Option>, is_closed: bool, pool: Arc>>, } +// manual impl to add the 'static bound for 1.7 compat +impl fmt::Debug for PooledStream where S: fmt::Debug + 'static { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.debug_struct("PooledStream") + .field("inner", &self.inner) + .field("is_closed", &self.is_closed) + .field("pool", &self.pool) + .finish() + } +} + impl PooledStream { /// Take the wrapped stream out of the pool completely. pub fn into_inner(mut self) -> S {