Skip to content

Commit aa69223

Browse files
committed
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.
1 parent 053eeeb commit aa69223

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/client/pool.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Client Connection Pooling
22
use std::borrow::ToOwned;
33
use std::collections::HashMap;
4+
use std::fmt;
45
use std::io::{self, Read, Write};
56
use std::net::{SocketAddr, Shutdown};
67
use std::sync::{Arc, Mutex};
@@ -136,13 +137,23 @@ impl<C: NetworkConnector<Stream=S>, S: NetworkStream + Send> NetworkConnector fo
136137
}
137138

138139
/// A Stream that will try to be returned to the Pool when dropped.
139-
#[derive(Debug)]
140140
pub struct PooledStream<S> {
141141
inner: Option<PooledStreamInner<S>>,
142142
is_closed: bool,
143143
pool: Arc<Mutex<PoolImpl<S>>>,
144144
}
145145

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+
146157
impl<S: NetworkStream> PooledStream<S> {
147158
/// Take the wrapped stream out of the pool completely.
148159
pub fn into_inner(mut self) -> S {

0 commit comments

Comments
 (0)