tls: Add get_ref and get_mut (#1537)

This commit is contained in:
Jon Gjengset
2019-09-04 17:45:53 -04:00
committed by GitHub
parent 9766cd644f
commit 9b3f8564af
+16
View File
@@ -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>