[][src]Struct mysql_async::PoolOpts

pub struct PoolOpts { /* fields omitted */ }

Connection pool options.

let pool_opts = PoolOpts::default()
    .with_constraints(PoolConstraints::new(15, 30).unwrap())
    .with_inactive_connection_ttl(Duration::from_secs(60));

Methods

impl PoolOpts[src]

pub fn with_constraints(self, constraints: PoolConstraints) -> Self[src]

Creates the default PoolOpts with the given constraints.

pub fn constraints(&self) -> PoolConstraints[src]

Returns pool constraints.

pub fn with_inactive_connection_ttl(self, ttl: Duration) -> Self[src]

Pool will recycle inactive connection if it is outside of the lower bound of the pool and if it is idling longer than this value (defaults to DEFAULT_INACTIVE_CONNECTION_TTL).

Note that it may, actually, idle longer because of PoolOpts::ttl_check_interval.

Connection URL

You can use inactive_connection_ttl URL parameter to set this value (in seconds). E.g.

let opts = Opts::from_url("mysql://localhost/db?inactive_connection_ttl=60")?;
assert_eq!(opts.pool_opts().inactive_connection_ttl(), Duration::from_secs(60));

pub fn inactive_connection_ttl(&self) -> Duration[src]

Returns a inactive_connection_ttl value.

pub fn with_ttl_check_interval(self, interval: Duration) -> Self[src]

Pool will check idling connection for expiration with this interval (defaults to DEFAULT_TTL_CHECK_INTERVAL).

If interval is less than one second, then DEFAULT_TTL_CHECK_INTERVAL will be used.

Connection URL

You can use ttl_check_interval URL parameter to set this value (in seconds). E.g.

let opts = Opts::from_url("mysql://localhost/db?ttl_check_interval=60")?;
assert_eq!(opts.pool_opts().ttl_check_interval(), Duration::from_secs(60));

pub fn ttl_check_interval(&self) -> Duration[src]

Returns a ttl_check_interval value.

Trait Implementations

impl Clone for PoolOpts[src]

impl Debug for PoolOpts[src]

impl Default for PoolOpts[src]

impl Eq for PoolOpts[src]

impl Hash for PoolOpts[src]

impl PartialEq<PoolOpts> for PoolOpts[src]

impl StructuralEq for PoolOpts[src]

impl StructuralPartialEq for PoolOpts[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,