diff --git a/src/client.rs b/src/client.rs index 834e3bb..05ecfd6 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1360,6 +1360,16 @@ impl Session { impl Connection { unsafe_pinned!(stream: ImapStream); + /// Gets a reference to the underlying stream. + pub fn get_ref(&self) -> &T { + self.stream.get_ref() + } + + /// Gets a mutable reference to the underlying stream. + pub fn get_mut(&mut self) -> &mut T { + self.stream.get_mut() + } + /// Convert this connection into the raw underlying stream. pub fn into_inner(self) -> T { let Self { stream, .. } = self; diff --git a/src/imap_stream.rs b/src/imap_stream.rs index cc3a497..58f03d0 100644 --- a/src/imap_stream.rs +++ b/src/imap_stream.rs @@ -54,6 +54,17 @@ impl ImapStream { Ok(()) } + /// Gets a reference to the underlying stream. + pub fn get_ref(&self) -> &R { + &self.inner + } + + /// Gets a mutable reference to the underlying stream. + pub fn get_mut(&mut self) -> &mut R { + &mut self.inner + } + + /// Returns underlying stream. pub fn into_inner(self) -> R { self.inner }