From f31a7ebc520bffb1247a6812473ea7de817178ed Mon Sep 17 00:00:00 2001 From: fakeshadow <24548779@qq.com> Date: Tue, 17 Sep 2024 22:57:52 +0800 Subject: [PATCH 1/2] [features] add `pool` crate feature --- Cargo.toml | 9 +++++---- src/lib.rs | 7 +------ src/pooled_connection/mod.rs | 1 + 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 44fa4f9..3c8da29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,10 +60,11 @@ postgres = ["diesel/postgres_backend", "tokio-postgres", "tokio", "tokio/rt"] sqlite = ["diesel/sqlite", "sync-connection-wrapper"] sync-connection-wrapper = ["tokio/rt"] async-connection-wrapper = ["tokio/net"] -r2d2 = ["diesel/r2d2"] -bb8 = ["dep:bb8"] -mobc = ["dep:mobc"] -deadpool = ["dep:deadpool"] +pool = [] +r2d2 = ["pool", "diesel/r2d2"] +bb8 = ["pool", "dep:bb8"] +mobc = ["pool", "dep:mobc"] +deadpool = ["pool", "dep:deadpool"] [[test]] name = "integration_tests" diff --git a/src/lib.rs b/src/lib.rs index db532b0..3bc02fe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -86,12 +86,7 @@ pub mod async_connection_wrapper; mod mysql; #[cfg(feature = "postgres")] pub mod pg; -#[cfg(any( - feature = "deadpool", - feature = "bb8", - feature = "mobc", - feature = "r2d2" -))] +#[cfg(feature = "pool")] pub mod pooled_connection; mod run_query_dsl; #[cfg(any(feature = "postgres", feature = "mysql"))] diff --git a/src/pooled_connection/mod.rs b/src/pooled_connection/mod.rs index 2ff16cf..21471b1 100644 --- a/src/pooled_connection/mod.rs +++ b/src/pooled_connection/mod.rs @@ -119,6 +119,7 @@ where /// * [deadpool](self::deadpool) /// * [bb8](self::bb8) /// * [mobc](self::mobc) +#[allow(dead_code)] pub struct AsyncDieselConnectionManager { connection_url: String, manager_config: ManagerConfig, From 8474e4f31b8768a8661abdbfe8a262edea4f4ff7 Mon Sep 17 00:00:00 2001 From: fakeshadow <24548779@qq.com> Date: Tue, 17 Sep 2024 23:03:25 +0800 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index acaf7ed..cf4b014 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ for Rust libraries in [RFC #1105](https://github.com/rust-lang/rfcs/blob/master/ ## [Unreleased] +* Add crate feature `pool` for extending connection pool implements through external crate + ## [0.5.0] - 2024-07-19 * Added type `diesel_async::pooled_connection::mobc::PooledConnection`