PoolBuilder

Struct PoolBuilder 

Source
pub struct PoolBuilder { /* private fields */ }
Expand description

Builder for creating connection pools with custom configuration

§Example

use oracle_rs::Config;
use deadpool_oracle::PoolBuilder;
use std::time::Duration;

let config = Config::new("localhost", 1521, "FREEPDB1", "user", "password");
let pool = PoolBuilder::new(config)
    .max_size(20)
    .wait_timeout(Some(Duration::from_secs(30)))
    .build()
    .expect("Failed to build pool");

Implementations§

Source§

impl PoolBuilder

Source

pub fn new(config: Config) -> Self

Create a new pool builder with the given connection configuration

Source

pub fn max_size(self, size: usize) -> Self

Set the maximum number of connections in the pool

Default is num_cpus * 4.

Source

pub fn wait_timeout(self, timeout: Option<Duration>) -> Self

Set the timeout for waiting for a connection from the pool

If the pool is exhausted, this is how long to wait before returning an error. Default is 30 seconds. Set to None to wait indefinitely.

Source

pub fn create_timeout(self, timeout: Option<Duration>) -> Self

Set the timeout for creating a new connection

Default is 30 seconds. Set to None to wait indefinitely.

Source

pub fn recycle_timeout(self, timeout: Option<Duration>) -> Self

Set the timeout for recycling a connection (health check)

Default is 5 seconds. Set to None to wait indefinitely.

Source

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

Build the connection pool

This creates the pool but does not establish any connections. Connections are created lazily when first requested.

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more