lettre/transport/smtp/pool/
mod.rs1use std::time::Duration;
2
3#[cfg(any(feature = "tokio1", feature = "async-std1"))]
4pub(super) mod async_impl;
5pub(super) mod sync_impl;
6
7#[derive(Debug, Clone)]
9#[allow(missing_copy_implementations)]
10#[cfg_attr(docsrs, doc(cfg(feature = "pool")))]
11pub struct PoolConfig {
12 min_idle: u32,
13 max_size: u32,
14 idle_timeout: Duration,
15}
16
17impl PoolConfig {
18 pub fn new() -> Self {
20 Self::default()
21 }
22
23 pub fn min_idle(mut self, min_idle: u32) -> Self {
27 self.min_idle = min_idle;
28 self
29 }
30
31 pub fn max_size(mut self, max_size: u32) -> Self {
35 self.max_size = max_size;
36 self
37 }
38
39 #[doc(hidden)]
43 #[deprecated(note = "The Connection timeout is already configured on the SMTP transport")]
44 pub fn connection_timeout(self, connection_timeout: Duration) -> Self {
45 let _ = connection_timeout;
46 self
47 }
48
49 pub fn idle_timeout(mut self, idle_timeout: Duration) -> Self {
53 self.idle_timeout = idle_timeout;
54 self
55 }
56}
57
58impl Default for PoolConfig {
59 fn default() -> Self {
60 Self {
61 min_idle: 0,
62 max_size: 10,
63 idle_timeout: Duration::from_secs(60),
64 }
65 }
66}