pub struct PoolOpts {
pub constraints: PoolConstraints,
pub reset_connection: bool,
pub connect_timeout: Duration,
pub read_timeout: Duration,
pub write_timeout: Duration,
pub tcp_keepalive: Duration,
}Expand description
连接池选项配置(参考 mysql 的 PoolOpts)
Fields§
§constraints: PoolConstraints连接池约束
reset_connection: bool是否在归还连接时重置连接
connect_timeout: Duration连接超时时间
read_timeout: Duration读取超时时间
write_timeout: Duration写入超时时间
tcp_keepalive: DurationTCP keepalive 时间
Implementations§
Source§impl PoolOpts
impl PoolOpts
Sourcepub fn with_constraints(self, constraints: PoolConstraints) -> Self
pub fn with_constraints(self, constraints: PoolConstraints) -> Self
设置连接池约束
Sourcepub fn with_reset_connection(self, reset: bool) -> Self
pub fn with_reset_connection(self, reset: bool) -> Self
设置是否重置连接
Sourcepub fn with_connect_timeout(self, timeout: Duration) -> Self
pub fn with_connect_timeout(self, timeout: Duration) -> Self
设置连接超时
Sourcepub fn with_read_timeout(self, timeout: Duration) -> Self
pub fn with_read_timeout(self, timeout: Duration) -> Self
设置读取超时
Sourcepub fn with_write_timeout(self, timeout: Duration) -> Self
pub fn with_write_timeout(self, timeout: Duration) -> Self
设置写入超时
Sourcepub fn with_tcp_keepalive(self, keepalive: Duration) -> Self
pub fn with_tcp_keepalive(self, keepalive: Duration) -> Self
设置 TCP keepalive
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PoolOpts
impl RefUnwindSafe for PoolOpts
impl Send for PoolOpts
impl Sync for PoolOpts
impl Unpin for PoolOpts
impl UnwindSafe for PoolOpts
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