pub struct PoolConfig {Show 16 fields
pub min_size: usize,
pub max_size: usize,
pub acquire_timeout: Option<f64>,
pub create_timeout: Option<f64>,
pub max_waiters: Option<usize>,
pub max_lifetime: Option<f64>,
pub lifetime_jitter: f64,
pub max_idle_time: Option<f64>,
pub max_uses: Option<u64>,
pub idle_strategy: IdleStrategy,
pub validate_after_idle: Option<f64>,
pub maintenance_interval: Option<f64>,
pub leak_detection_timeout: Option<f64>,
pub validate_idle: bool,
pub retry: RetryPolicy,
pub breaker: Option<BreakerConfig>,
}Expand description
An immutable, validated pool configuration. Build one with struct-update syntax from
PoolConfig::default, then hand it to a pool — which re-validates it.
use connpool::PoolConfig;
let cfg = PoolConfig { max_size: 20, min_size: 2, ..Default::default() };
assert!(cfg.validate().is_ok());Fields§
§min_size: usizeMinimum connections kept warm by open() and the maintenance pass.
max_size: usizeHard cap on total connections (idle + in use + being created).
acquire_timeout: Option<f64>Default wait in acquire().
create_timeout: Option<f64>Enforced by the async pool only; blocking factories must enforce their own connect timeout.
max_waiters: Option<usize>Backpressure: cap callers blocked in acquire() (None = unlimited; 0 = never wait
when full).
max_lifetime: Option<f64>Retire connections after this age.
lifetime_jitter: f64Shave up to this fraction off each lifetime so a whole pool never expires at once.
max_idle_time: Option<f64>Evict idle connections (down to min_size).
max_uses: Option<u64>Retire after N checkouts.
idle_strategy: IdleStrategyLIFO or FIFO idle reuse.
validate_after_idle: Option<f64>Validate on checkout if idle >= this (0 = always, None = never).
maintenance_interval: Option<f64>Background sweep period (None = off).
leak_detection_timeout: Option<f64>Warn when a borrowed connection is held longer than this (None = off); needs open().
validate_idle: boolValidate idle connections during the maintenance sweep and evict dead ones (needs
open(); adds I/O).
retry: RetryPolicyRetry policy for factory.create().
breaker: Option<BreakerConfig>Circuit breaker config (None = off).