Type Alias diesel_async::pooled_connection::deadpool::PoolBuilder
source · pub type PoolBuilder<C> = PoolBuilder<AsyncDieselConnectionManager<C>>;
Expand description
Type alias for using deadpool::managed::PoolBuilder
with [diesel-async
]
Aliased Type§
struct PoolBuilder<C> { /* private fields */ }
Implementations
source§impl<M, W> PoolBuilder<M, W>
impl<M, W> PoolBuilder<M, W>
sourcepub fn config(self, value: PoolConfig) -> PoolBuilder<M, W>
pub fn config(self, value: PoolConfig) -> PoolBuilder<M, W>
Sets a PoolConfig
to build the Pool
with.
sourcepub fn max_size(self, value: usize) -> PoolBuilder<M, W>
pub fn max_size(self, value: usize) -> PoolBuilder<M, W>
Sets the PoolConfig::max_size
.
sourcepub fn timeouts(self, value: Timeouts) -> PoolBuilder<M, W>
pub fn timeouts(self, value: Timeouts) -> PoolBuilder<M, W>
Sets the PoolConfig::timeouts
.
sourcepub fn wait_timeout(self, value: Option<Duration>) -> PoolBuilder<M, W>
pub fn wait_timeout(self, value: Option<Duration>) -> PoolBuilder<M, W>
Sets the Timeouts::wait
value of the PoolConfig::timeouts
.
sourcepub fn create_timeout(self, value: Option<Duration>) -> PoolBuilder<M, W>
pub fn create_timeout(self, value: Option<Duration>) -> PoolBuilder<M, W>
Sets the Timeouts::create
value of the PoolConfig::timeouts
.
sourcepub fn recycle_timeout(self, value: Option<Duration>) -> PoolBuilder<M, W>
pub fn recycle_timeout(self, value: Option<Duration>) -> PoolBuilder<M, W>
Sets the Timeouts::recycle
value of the PoolConfig::timeouts
.
sourcepub fn post_create(self, hook: impl Into<Hook<M>>) -> PoolBuilder<M, W>
pub fn post_create(self, hook: impl Into<Hook<M>>) -> PoolBuilder<M, W>
Attaches a post_create
hook.
The given hook
will be called each time right after a new Object
has been created.
sourcepub fn pre_recycle(self, hook: impl Into<Hook<M>>) -> PoolBuilder<M, W>
pub fn pre_recycle(self, hook: impl Into<Hook<M>>) -> PoolBuilder<M, W>
Attaches a pre_recycle
hook.
The given hook
will be called each time right before an Object
will
be recycled.
sourcepub fn post_recycle(self, hook: impl Into<Hook<M>>) -> PoolBuilder<M, W>
pub fn post_recycle(self, hook: impl Into<Hook<M>>) -> PoolBuilder<M, W>
Attaches a post_recycle
hook.
The given hook
will be called each time right after an Object
has
been recycled.
sourcepub fn runtime(self, value: Runtime) -> PoolBuilder<M, W>
pub fn runtime(self, value: Runtime) -> PoolBuilder<M, W>
Sets the Runtime
.
§Important
The Runtime
is optional. Most Pool
s don’t need a
Runtime
. If want to utilize timeouts, however a Runtime
must be
specified as you will otherwise get a PoolError::NoRuntimeSpecified
when trying to use Pool::timeout_get()
.
PoolBuilder::build()
will fail with a
BuildError::NoRuntimeSpecified
if you try to build a
Pool
with timeouts and no Runtime
specified.