[−][src]Struct bb8::Builder
A builder for a connection pool.
Implementations
impl<M: ManageConnection> Builder<M>
[src]
pub fn new() -> Builder<M>
[src]
Constructs a new Builder
.
Parameters are initialized with their default values.
pub fn max_size(self, max_size: u32) -> Builder<M>
[src]
Sets the maximum number of connections managed by the pool.
Defaults to 10.
pub fn min_idle(self, min_idle: Option<u32>) -> Builder<M>
[src]
Sets the minimum idle connection count maintained by the pool.
If set, the pool will try to maintain at least this many idle
connections at all times, while respecting the value of max_size
.
Defaults to None.
pub fn test_on_check_out(self, test_on_check_out: bool) -> Builder<M>
[src]
If true, the health of a connection will be verified through a call to
ManageConnection::is_valid
before it is provided to a pool user.
Defaults to true.
pub fn max_lifetime(self, max_lifetime: Option<Duration>) -> Builder<M>
[src]
Sets the maximum lifetime of connections in the pool.
If set, connections will be closed at the next reaping after surviving past this duration.
If a connection reachs its maximum lifetime while checked out it will be closed when it is returned to the pool.
Defaults to 30 minutes.
pub fn idle_timeout(self, idle_timeout: Option<Duration>) -> Builder<M>
[src]
Sets the idle timeout used by the pool.
If set, idle connections in excess of min_idle
will be closed at the
next reaping after remaining idle past this duration.
Defaults to 10 minutes.
pub fn connection_timeout(self, connection_timeout: Duration) -> Builder<M>
[src]
Sets the connection timeout used by the pool.
Futures returned by Pool::get
will wait this long before giving up and
resolving with an error.
Defaults to 30 seconds.
pub fn error_sink(self, error_sink: Box<dyn ErrorSink<M::Error>>) -> Builder<M>
[src]
Set the sink for errors that are not associated with any particular operation on the pool. This can be used to log and monitor failures.
Defaults to NopErrorSink
.
pub fn reaper_rate(self, reaper_rate: Duration) -> Builder<M>
[src]
Used by tests
pub async fn build(self, manager: M) -> Result<Pool<M>, M::Error>
[src]
Consumes the builder, returning a new, initialized Pool
.
The Pool
will not be returned until it has established its configured
minimum number of connections, or it times out.
pub fn build_unchecked(self, manager: M) -> Pool<M>
[src]
Consumes the builder, returning a new, initialized Pool
.
Unlike build
, this does not wait for any connections to be established
before returning.
Trait Implementations
impl<M: Debug + ManageConnection> Debug for Builder<M> where
M::Error: Debug,
[src]
M::Error: Debug,
impl<M: ManageConnection> Default for Builder<M>
[src]
Auto Trait Implementations
impl<M> !RefUnwindSafe for Builder<M>
impl<M> Send for Builder<M>
impl<M> Sync for Builder<M>
impl<M> Unpin for Builder<M> where
M: Unpin,
M: Unpin,
impl<M> !UnwindSafe for Builder<M>
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,
pub 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.
pub 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>,