deadpool_sqlite

Type Alias PoolBuilder

Source
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>
where M: Manager, W: From<Object<M>>,

Source

pub fn build(self) -> Result<Pool<M, W>, BuildError>

Builds the Pool.

§Errors

See BuildError for details.

Source

pub fn config(self, value: PoolConfig) -> PoolBuilder<M, W>

Sets a PoolConfig to build the Pool with.

Source

pub fn max_size(self, value: usize) -> PoolBuilder<M, W>

Source

pub fn timeouts(self, value: Timeouts) -> PoolBuilder<M, W>

Source

pub fn wait_timeout(self, value: Option<Duration>) -> PoolBuilder<M, W>

Sets the Timeouts::wait value of the PoolConfig::timeouts.

Source

pub fn create_timeout(self, value: Option<Duration>) -> PoolBuilder<M, W>

Sets the Timeouts::create value of the PoolConfig::timeouts.

Source

pub fn recycle_timeout(self, value: Option<Duration>) -> PoolBuilder<M, W>

Sets the Timeouts::recycle value of the PoolConfig::timeouts.

Source

pub fn queue_mode(self, value: QueueMode) -> PoolBuilder<M, W>

Source

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.

Source

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.

Source

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.

Source

pub fn runtime(self, value: Runtime) -> PoolBuilder<M, W>

Sets the Runtime.

§Important

The Runtime is optional. Most Pools 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.

Trait Implementations

Source§

impl<M, W> Debug for PoolBuilder<M, W>
where M: Debug + Manager, W: From<Object<M>>,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more