pub struct PoolOptions {
pub max_connections: u32,
pub min_connections: u32,
pub acquire_timeout: Duration,
pub idle_timeout: Option<Duration>,
pub max_lifetime: Option<Duration>,
pub test_before_acquire: bool,
}Expand description
Pool options.
Fields§
§max_connections: u32Maximum number of connections.
min_connections: u32Minimum number of connections to keep idle.
acquire_timeout: DurationMaximum time to wait for a connection.
idle_timeout: Option<Duration>Maximum idle time before closing a connection.
max_lifetime: Option<Duration>Maximum lifetime of a connection.
test_before_acquire: boolTest connections before returning them.
Implementations§
Source§impl PoolOptions
impl PoolOptions
Sourcepub fn max_connections(self, n: u32) -> Self
pub fn max_connections(self, n: u32) -> Self
Set max connections.
Sourcepub fn min_connections(self, n: u32) -> Self
pub fn min_connections(self, n: u32) -> Self
Set min connections.
Sourcepub fn acquire_timeout(self, timeout: Duration) -> Self
pub fn acquire_timeout(self, timeout: Duration) -> Self
Set acquire timeout.
Sourcepub fn idle_timeout(self, timeout: Duration) -> Self
pub fn idle_timeout(self, timeout: Duration) -> Self
Set idle timeout.
Sourcepub fn no_idle_timeout(self) -> Self
pub fn no_idle_timeout(self) -> Self
Disable idle timeout.
Sourcepub fn max_lifetime(self, lifetime: Duration) -> Self
pub fn max_lifetime(self, lifetime: Duration) -> Self
Set max lifetime.
Sourcepub fn no_max_lifetime(self) -> Self
pub fn no_max_lifetime(self) -> Self
Disable max lifetime.
Sourcepub fn test_before_acquire(self, enabled: bool) -> Self
pub fn test_before_acquire(self, enabled: bool) -> Self
Enable/disable test before acquire.
Trait Implementations§
Source§impl Clone for PoolOptions
impl Clone for PoolOptions
Source§fn clone(&self) -> PoolOptions
fn clone(&self) -> PoolOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PoolOptions
impl Debug for PoolOptions
Auto Trait Implementations§
impl Freeze for PoolOptions
impl RefUnwindSafe for PoolOptions
impl Send for PoolOptions
impl Sync for PoolOptions
impl Unpin for PoolOptions
impl UnwindSafe for PoolOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more