use std::ops::Deref;
use super::{backend::r#trait::Backend, db_pool::ReusableConnectionPool};
/// Connection pool wrapper to facilitate the use of pools in code under test and reusable pools in tests
pub enum PoolWrapper<B: Backend> {
/// Connection pool used in code under test
Pool(B::Pool),
/// Reusable connection pool used in tests
ReusablePool(ReusableConnectionPool<'static, B>),
}
impl<B: Backend> Deref for PoolWrapper<B> {
type Target = B::Pool;
fn deref(&self) -> &Self::Target {
match self {
Self::Pool(pool) => pool,
Self::ReusablePool(pool) => pool,
}
}
}