Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ability to get SmtpStream from SmtpTransport #64

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions src/smtp_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ impl<S: BufRead + Write + Unpin> SmtpTransport<S> {
Ok(transport)
}

/// Get the underlying SmtpStream.
amaury1093 marked this conversation as resolved.
Show resolved Hide resolved
pub fn get_stream(&mut self) -> &mut SmtpStream<S> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is usually named get_mut(), see for example https://docs.rs/tokio-rustls/latest/tokio_rustls/enum.TlsStream.html and https://docs.rs/tokio/latest/tokio/io/struct.BufWriter.html#method.get_mut

I would also provide get_ref() before it to get non-mutable reference, and maybe also into_inner() which is another common method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Added get_mut, get_ref and into_inner

&mut self.stream
}

/// Try to login with the given accepted mechanisms.
pub async fn try_login(
&mut self,
Expand Down
Loading