pub struct PoolConfig {
pub max_connections: Option<u32>,
pub min_connections: Option<u32>,
pub acquire_timeout_secs: Option<u64>,
pub idle_timeout_secs: Option<u64>,
pub max_lifetime_secs: Option<u64>,
}Expand description
Declarative pool configuration.
All fields are optional; unset fields use SQLx defaults.
Can be converted into a PoolBuilder via PoolConfig::into_builder.
§Environment variables
PoolConfig::from_env() reads:
DATABASE_MAX_CONNECTIONSDATABASE_MIN_CONNECTIONSDATABASE_ACQUIRE_TIMEOUT_SECSDATABASE_IDLE_TIMEOUT_SECSDATABASE_MAX_LIFETIME_SECS
Fields§
§max_connections: Option<u32>§min_connections: Option<u32>§acquire_timeout_secs: Option<u64>§idle_timeout_secs: Option<u64>§max_lifetime_secs: Option<u64>Implementations§
Source§impl PoolConfig
impl PoolConfig
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Load pool configuration from environment variables.
Missing or unparseable variables are silently ignored (treated as unset).
Sourcepub fn into_builder<DB: Database>(self) -> PoolBuilder<DB>
pub fn into_builder<DB: Database>(self) -> PoolBuilder<DB>
Convert this config into a PoolBuilder, applying all set fields.
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 (const: unstable) · 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
Source§impl Default for PoolConfig
impl Default for PoolConfig
Source§fn default() -> PoolConfig
fn default() -> PoolConfig
Returns the “default value” for a type. Read more
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: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more