[−][src]Struct mobc::Builder
A builder for a connection pool.
Methods
impl<M: Manager> Builder<M>
[src]
pub fn new() -> Self
[src]
Constructs a new Builder
.
Parameters are initialized with their default values.
pub fn max_open(self, max_open: u64) -> Self
[src]
Sets the maximum number of connections managed by the pool.
0 means unlimited, defaults to 10.
pub fn max_idle(self, max_idle: u64) -> Self
[src]
Sets the maximum idle connection count maintained by the pool.
The pool will maintain at most this many idle connections
at all times, while respecting the value of max_open
.
Defaults to 2.
pub fn test_on_check_out(self, health_check: bool) -> Builder<M>
[src]
If true, the health of a connection will be verified via a call to
Manager::check
before it is checked out of the pool.
Defaults to true.
pub fn max_lifetime(self, max_lifetime: Option<Duration>) -> Self
[src]
Sets the maximum lifetime of connections in the pool.
Expired connections may be closed lazily before reuse.
None meas reuse forever. Defaults to None.
Panics
Panics if max_lifetime
is the zero Duration
.
pub fn get_timeout(self, get_timeout: Option<Duration>) -> Self
[src]
Sets the get timeout used by the pool.
Calls to Pool::get
will wait this long for a connection to become
available before returning an error.
None meas never timeout. Defaults to 30 seconds.
Panics
Panics if connection_timeout
is the zero duration
pub fn build(self, manager: M) -> Pool<M>
[src]
Consumes the builder, returning a new, initialized pool.
Panics
Panics if max_idle
is greater than max_size
.
Trait Implementations
Auto Trait Implementations
impl<M> RefUnwindSafe for Builder<M> where
M: RefUnwindSafe,
M: RefUnwindSafe,
impl<M> Send for Builder<M> where
M: Send,
M: Send,
impl<M> Sync for Builder<M> where
M: Sync,
M: Sync,
impl<M> Unpin for Builder<M> where
M: Unpin,
M: Unpin,
impl<M> UnwindSafe for Builder<M> where
M: UnwindSafe,
M: UnwindSafe,
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, 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>,