pub struct PoolConfig {
pub min_connections: usize,
pub max_connections: usize,
pub idle_timeout_ms: u64,
pub acquire_timeout_ms: u64,
pub max_lifetime_ms: u64,
pub test_on_checkout: bool,
pub test_on_return: bool,
}Expand description
Connection pool configuration.
Fields§
§min_connections: usizeMinimum number of connections to maintain
max_connections: usizeMaximum number of connections allowed
idle_timeout_ms: u64Connection idle timeout in milliseconds
acquire_timeout_ms: u64Maximum time to wait for a connection in milliseconds
max_lifetime_ms: u64Maximum lifetime of a connection in milliseconds
test_on_checkout: boolTest connections before giving them out
test_on_return: boolTest connections when returning them to the pool
Implementations§
Source§impl PoolConfig
impl PoolConfig
Sourcepub fn new(max_connections: usize) -> Self
pub fn new(max_connections: usize) -> Self
Create a new pool configuration with the given max connections.
Sourcepub fn min_connections(self, n: usize) -> Self
pub fn min_connections(self, n: usize) -> Self
Set minimum connections.
Sourcepub fn idle_timeout(self, ms: u64) -> Self
pub fn idle_timeout(self, ms: u64) -> Self
Set idle timeout in milliseconds.
Sourcepub fn acquire_timeout(self, ms: u64) -> Self
pub fn acquire_timeout(self, ms: u64) -> Self
Set acquire timeout in milliseconds.
Sourcepub fn max_lifetime(self, ms: u64) -> Self
pub fn max_lifetime(self, ms: u64) -> Self
Set max lifetime in milliseconds.
Sourcepub fn test_on_checkout(self, enabled: bool) -> Self
pub fn test_on_checkout(self, enabled: bool) -> Self
Enable/disable test on checkout.
Sourcepub fn test_on_return(self, enabled: bool) -> Self
pub fn test_on_return(self, enabled: bool) -> Self
Enable/disable test on return.
Trait Implementations§
Source§impl Clone for PoolConfig
impl Clone for PoolConfig
Source§fn clone(&self) -> PoolConfig
fn clone(&self) -> PoolConfig
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 PoolConfig
impl Debug for PoolConfig
Auto Trait Implementations§
impl Freeze for PoolConfig
impl RefUnwindSafe for PoolConfig
impl Send for PoolConfig
impl Sync for PoolConfig
impl Unpin for PoolConfig
impl UnsafeUnpin for PoolConfig
impl UnwindSafe for PoolConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).