[−][src]Struct mysql_async::PoolOpts
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<PoolOpts> for PoolOpts
[src]
impl StructuralEq for PoolOpts
[src]
impl StructuralPartialEq for PoolOpts
[src]
Auto Trait Implementations
impl RefUnwindSafe for PoolOpts
impl Send for PoolOpts
impl Sync for PoolOpts
impl Unpin for PoolOpts
impl UnwindSafe for PoolOpts
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,