Skip to content

Commit

Permalink
tls: Add get_ref and get_mut (#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhoo committed Sep 4, 2019
1 parent 9766cd6 commit 9b3f856
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tokio-tls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,22 @@ impl<S> TlsStream<S> {
let g = Guard(self);
f(&mut (g.0).0)
}

/// Returns a shared reference to the inner stream.
pub fn get_ref(&self) -> &S
where
S: AsyncRead + AsyncWrite + Unpin,
{
&self.0.get_ref().inner
}

/// Returns a mutable reference to the inner stream.
pub fn get_mut(&mut self) -> &mut S
where
S: AsyncRead + AsyncWrite + Unpin,
{
&mut self.0.get_mut().inner
}
}

impl<S> AsyncRead for TlsStream<S>
Expand Down

0 comments on commit 9b3f856

Please sign in to comment.