pub struct Builder<M> where
    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.

Panics

Panics if max_size is 0.

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 (equivalent to the value of max_size).

Sets the thread pool used for asynchronous operations such as connection creation.

Defaults to a new pool with 3 threads.

If true, the health of a connection will be verified via a call to ConnectionManager::is_valid before it is checked out of the pool.

Defaults to true.

Sets the maximum lifetime of connections in the pool.

If set, connections will be closed after existing for at most 30 seconds beyond this duration.

If a connection reaches its maximum lifetime while checked out it will be closed when it is returned to the pool.

Defaults to 30 minutes.

Panics

Panics if max_lifetime is the zero Duration.

Sets the idle timeout used by the pool.

If set, connections will be closed after sitting idle for at most 30 seconds beyond this duration.

Defaults to 10 minutes.

Panics

Panics if idle_timeout is the zero Duration.

Sets the connection timeout used by the pool.

Calls to Pool::get will wait this long for a connection to become available before returning an error.

Defaults to 30 seconds.

Panics

Panics if connection_timeout is the zero duration

Sets the handler for errors reported in the pool.

Defaults to the LoggingErrorHandler.

Sets the handler for events reported by the pool.

Defaults to the NopEventHandler.

Sets the connection customizer used by the pool.

Defaults to the NopConnectionCustomizer.

Consumes the builder, returning a new, initialized pool.

It will block until the pool has established its configured minimum number of connections, or it times out.

Errors

Returns an error if the pool is unable to open its minimum number of connections.

Panics

Panics if min_idle is greater than max_size.

Consumes the builder, returning a new pool.

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

Panics

Panics if min_idle is greater than max_size.

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.

Convert self to an expression for Diesel’s query builder. Read more

Convert &self to an expression for Diesel’s query builder. Read more

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.