Struct r2d2::config::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> Config<C, E>
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 number of connections managed by the pool.
Defaults to 10.
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 connection_timeout_ms(&self) -> u32
Calls to Pool::get
will wait this many milliseconds 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::NopErrorHandler
.
fn connection_customizer(&self) -> &CustomizeConnection<C, E>
The connection customizer used by the pool.
Defaults to r2d2::NopConnectionCustomizer
.