Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,16 @@ impl<T: Read + Write + Unpin + fmt::Debug + Send> Session<T> {
impl<T: Read + Write + Unpin + fmt::Debug> Connection<T> {
unsafe_pinned!(stream: ImapStream<T>);

/// 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;
Expand Down
11 changes: 11 additions & 0 deletions src/imap_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ impl<R: Read + Write + Unpin> ImapStream<R> {
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
}
Expand Down
Loading