Skip to content

Commit

Permalink
feat(client): introduce PooledStream::<S>::get_ref
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Apr 10, 2017
1 parent 04d9119 commit a54ce30
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/client/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ impl<S: NetworkStream> PooledStream<S> {
pub fn into_inner(mut self) -> S {
self.inner.take().expect("PooledStream lost its inner stream").stream
}

/// Gets a borrowed reference to the underlying stream.
pub fn get_ref(&self) -> &S {
&self.inner.as_ref().expect("PooledStream lost its inner stream").stream
}
}

#[derive(Debug)]
Expand Down

0 comments on commit a54ce30

Please sign in to comment.