pub trait ConnectionPool: Sized {
// Required methods
fn new<S>(
driver_name: S,
driver: Arc<Mutex<BoxedDriver>>,
url: S,
) -> Result<Self>
where S: Into<String> + AsRef<str>;
fn get_conn(&self) -> Result<Box<dyn Connection>>;
fn release_conn(&self, conn: Box<dyn Connection>);
}
Expand description
Database connection pool trait.
Required Methods§
Sourcefn new<S>(
driver_name: S,
driver: Arc<Mutex<BoxedDriver>>,
url: S,
) -> Result<Self>
fn new<S>( driver_name: S, driver: Arc<Mutex<BoxedDriver>>, url: S, ) -> Result<Self>
Create new connection pool
§Arguments
driver
- SQL thread safe driver instanceurl
- SQL driver connect url
Sourcefn get_conn(&self) -> Result<Box<dyn Connection>>
fn get_conn(&self) -> Result<Box<dyn Connection>>
Get new connection from pool or create new one from driver.
Sourcefn release_conn(&self, conn: Box<dyn Connection>)
fn release_conn(&self, conn: Box<dyn Connection>)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.