|
1 | 1 | //! Client Connection Pooling |
2 | 2 | use std::borrow::ToOwned; |
3 | 3 | use std::collections::HashMap; |
| 4 | +use std::fmt; |
4 | 5 | use std::io::{self, Read, Write}; |
5 | 6 | use std::net::{SocketAddr, Shutdown}; |
6 | 7 | use std::sync::{Arc, Mutex}; |
@@ -136,13 +137,23 @@ impl<C: NetworkConnector<Stream=S>, S: NetworkStream + Send> NetworkConnector fo |
136 | 137 | } |
137 | 138 |
|
138 | 139 | /// A Stream that will try to be returned to the Pool when dropped. |
139 | | -#[derive(Debug)] |
140 | 140 | pub struct PooledStream<S> { |
141 | 141 | inner: Option<PooledStreamInner<S>>, |
142 | 142 | is_closed: bool, |
143 | 143 | pool: Arc<Mutex<PoolImpl<S>>>, |
144 | 144 | } |
145 | 145 |
|
| 146 | +// manual impl to add the 'static bound for 1.7 compat |
| 147 | +impl<S> fmt::Debug for PooledStream<S> where S: fmt::Debug + 'static { |
| 148 | + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
| 149 | + fmt.debug_struct("PooledStream") |
| 150 | + .field("inner", &self.inner) |
| 151 | + .field("is_closed", &self.is_closed) |
| 152 | + .field("pool", &self.pool) |
| 153 | + .finish() |
| 154 | + } |
| 155 | +} |
| 156 | + |
146 | 157 | impl<S: NetworkStream> PooledStream<S> { |
147 | 158 | /// Take the wrapped stream out of the pool completely. |
148 | 159 | pub fn into_inner(mut self) -> S { |
|
0 commit comments