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
impl PoolBuilder
Sourcepub fn new(config: Config) -> Self
pub fn new(config: Config) -> Self
Create a new pool builder with the given connection configuration
Sourcepub fn max_size(self, size: usize) -> Self
pub fn max_size(self, size: usize) -> Self
Set the maximum number of connections in the pool
Default is num_cpus * 4.
Sourcepub fn wait_timeout(self, timeout: Option<Duration>) -> Self
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.
Sourcepub fn create_timeout(self, timeout: Option<Duration>) -> Self
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.
Sourcepub fn recycle_timeout(self, timeout: Option<Duration>) -> Self
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.
Sourcepub fn build(self) -> Result<Pool, BuildError>
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§
impl Freeze for PoolBuilder
impl RefUnwindSafe for PoolBuilder
impl Send for PoolBuilder
impl Sync for PoolBuilder
impl Unpin for PoolBuilder
impl UnwindSafe for PoolBuilder
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more