pub type PoolBuilder = PoolBuilder<Manager, Object<Manager>>;
Expand description
Type alias for using deadpool::managed::PoolBuilder
with rusqlite
.
Aliased Type§
struct PoolBuilder { /* private fields */ }
Implementations
Source§impl<M, W> PoolBuilder<M, W>
impl<M, W> PoolBuilder<M, W>
Sourcepub fn build(self) -> Result<Pool<M, W>, BuildError>
pub fn build(self) -> Result<Pool<M, W>, BuildError>
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 queue_mode(self, value: QueueMode) -> PoolBuilder<M, W>
pub fn queue_mode(self, value: QueueMode) -> PoolBuilder<M, W>
Sets the PoolConfig::queue_mode
.
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.