Struct bb8::Builder

source · []
pub struct Builder<M: ManageConnection> { /* private fields */ }
Expand description

A builder for a connection pool.

Implementations

Constructs a new Builder.

Parameters are initialized with their default values.

Sets the maximum number of connections managed by the pool.

Defaults to 10.

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.

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.

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.

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.

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.

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.

Used by tests

Set the connection customizer to customize newly checked out connections

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.

Consumes the builder, returning a new, initialized Pool.

Unlike build, this does not wait for any connections to be established before returning.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.