Struct r2d2::Config [] [src]

pub struct Config<C, E> {
    // some fields omitted
}

A struct specifying the runtime configuration of a pool.

Config implements Default, which provides a set of reasonable default values. It can be constructed using a Builder.

Methods

impl<C, E: Error> Config<C, E>
[src]

fn builder() -> Builder<C, E>

Creates a new Builder which can be used to construct a customized Config.

All parameters are initialized to their default values.

fn pool_size(&self) -> u32

The maximum number of connections managed by the pool.

Defaults to 10.

fn min_idle(&self) -> Option<u32>

If set, the pool will try to maintain at least this many idle connections at all times, while respecting the value of pool_size.

Defaults to None (equivalent to the value of pool_size).

fn helper_threads(&self) -> u32

The number of threads that the pool will use for asynchronous operations such as connection creation and health checks.

Defaults to 3.

fn test_on_check_out(&self) -> bool

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.

fn initialization_fail_fast(&self) -> bool

If true, Pool::new will synchronously initialize its connections, returning an error if they could not be created.

Defaults to true.

fn idle_timeout(&self) -> Option<Duration>

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

Defaults to 10 minutes.

fn max_lifetime(&self) -> Option<Duration>

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.

fn connection_timeout(&self) -> Duration

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

Defaults to 30 seconds.

fn error_handler(&self) -> &HandleError<E>

The handler for error reported in the pool.

Defaults to r2d2::LoggingErrorHandler.

fn connection_customizer(&self) -> &CustomizeConnection<C, E>

The connection customizer used by the pool.

Defaults to r2d2::NopConnectionCustomizer.

Trait Implementations

impl<C, E> Debug for Config<C, E>
[src]

fn fmt(&self, fmt: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<C, E: Error> Default for Config<C, E>
[src]

fn default() -> Config<C, E>

Returns the "default value" for a type. Read more