chore: remove SmtpClient from the public API
We don't provide a method to construct it anyway, so it doesn't make sense to expose it.
This commit is contained in:
committed by
Alexis Mousset
parent
393d414700
commit
1c4a3f0fb3
@@ -180,10 +180,10 @@ use std::time::Duration;
|
||||
|
||||
#[cfg(feature = "tokio02")]
|
||||
pub use self::async_transport::{
|
||||
AsyncSmtpClient, AsyncSmtpConnector, AsyncSmtpTransport, AsyncSmtpTransportBuilder,
|
||||
Tokio02Connector,
|
||||
AsyncSmtpConnector, AsyncSmtpTransport, AsyncSmtpTransportBuilder, Tokio02Connector,
|
||||
};
|
||||
pub use self::transport::{SmtpClient, SmtpTransport, SmtpTransportBuilder};
|
||||
pub(crate) use self::transport::SmtpClient;
|
||||
pub use self::transport::{SmtpTransport, SmtpTransportBuilder};
|
||||
#[cfg(any(feature = "native-tls", feature = "rustls-tls"))]
|
||||
use crate::transport::smtp::client::TlsParameters;
|
||||
use crate::transport::smtp::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::time::Duration;
|
||||
|
||||
#[cfg(feature = "r2d2")]
|
||||
use r2d2::{Builder, Pool};
|
||||
use r2d2::Pool;
|
||||
|
||||
use super::{ClientId, Credentials, Error, Mechanism, Response, SmtpConnection, SmtpInfo};
|
||||
#[cfg(any(feature = "native-tls", feature = "rustls-tls"))]
|
||||
@@ -150,13 +150,6 @@ impl SmtpTransportBuilder {
|
||||
SmtpClient { info: self.info }
|
||||
}
|
||||
|
||||
/// Build the transport with custom pool settings
|
||||
#[cfg(feature = "r2d2")]
|
||||
pub fn build_with_pool(self, pool: Builder<SmtpClient>) -> SmtpTransport {
|
||||
let pool = pool.build_unchecked(self.build_client());
|
||||
SmtpTransport { inner: pool }
|
||||
}
|
||||
|
||||
/// Build the transport
|
||||
///
|
||||
/// If the `r2d2` feature is enabled an `Arc` wrapped pool is be created.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#[cfg(all(test, feature = "smtp-transport", feature = "r2d2"))]
|
||||
mod test {
|
||||
use lettre::{Envelope, SmtpTransport, Transport};
|
||||
use r2d2::Pool;
|
||||
use std::{sync::mpsc, thread};
|
||||
|
||||
fn envelope() -> Envelope {
|
||||
@@ -14,10 +13,9 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn send_one() {
|
||||
let pool = Pool::builder().max_size(1);
|
||||
let mailer = SmtpTransport::builder_dangerous("127.0.0.1")
|
||||
.port(2525)
|
||||
.build_with_pool(pool);
|
||||
.build();
|
||||
|
||||
let result = mailer.send_raw(&envelope(), b"test");
|
||||
assert!(result.is_ok());
|
||||
@@ -25,11 +23,9 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn send_from_thread() {
|
||||
let pool = Pool::builder().max_size(1);
|
||||
|
||||
let mailer = SmtpTransport::builder_dangerous("127.0.0.1")
|
||||
.port(2525)
|
||||
.build_with_pool(pool);
|
||||
.build();
|
||||
|
||||
let (s1, r1) = mpsc::channel();
|
||||
let (s2, r2) = mpsc::channel();
|
||||
|
||||
Reference in New Issue
Block a user