We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e855f9e commit 4527367Copy full SHA for 4527367
src/stream.rs
@@ -24,6 +24,19 @@ pub enum MaybeTlsStream<S> {
24
Rustls(tokio_rustls::client::TlsStream<S>),
25
}
26
27
+impl<S> MaybeTlsStream<S> {
28
+ /// Returns a shared reference to the inner stream.
29
+ pub fn get_ref(&self) -> &S {
30
+ match self {
31
+ MaybeTlsStream::Plain(s) => s,
32
+ #[cfg(feature = "native-tls")]
33
+ MaybeTlsStream::NativeTls(s) => s.get_ref().get_ref().get_ref(),
34
+ #[cfg(feature = "__rustls-tls")]
35
+ MaybeTlsStream::Rustls(s) => s.get_ref().0,
36
+ }
37
38
+}
39
+
40
impl<S: AsyncRead + AsyncWrite + Unpin> AsyncRead for MaybeTlsStream<S> {
41
fn poll_read(
42
self: Pin<&mut Self>,
0 commit comments