Skip to content

Commit f9fa6db

Browse files
committed
Fix Clone support
(cherry picked from commit f7258e6)
1 parent b2b222b commit f9fa6db

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sqlx-tracing"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2024"
55
description = "OpenTelemetry-compatible tracing for SQLx database operations in Rust."
66
license = "MIT"

src/lib.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<DB: sqlx::Database> PoolBuilder<DB> {
110110
/// An asynchronous pool of SQLx database connections with tracing instrumentation.
111111
///
112112
/// Wraps a SQLx [`Pool`] and propagates tracing attributes to all acquired connections.
113-
#[derive(Clone, Debug)]
113+
#[derive(Debug)]
114114
pub struct Pool<DB>
115115
where
116116
DB: sqlx::Database,
@@ -119,14 +119,26 @@ where
119119
attributes: Arc<Attributes>,
120120
}
121121

122+
impl<DB> Clone for Pool<DB>
123+
where
124+
DB: sqlx::Database,
125+
{
126+
fn clone(&self) -> Self {
127+
Self {
128+
inner: self.inner.clone(),
129+
attributes: Arc::clone(&self.attributes),
130+
}
131+
}
132+
}
133+
122134
impl<DB> From<sqlx::Pool<DB>> for Pool<DB>
123135
where
124136
DB: sqlx::Database,
125137
PoolBuilder<DB>: From<sqlx::Pool<DB>>,
126138
{
127139
/// Convert a SQLx [`Pool`] into a tracing-instrumented [`Pool`].
128140
fn from(inner: sqlx::Pool<DB>) -> Self {
129-
PoolBuilder::from(inner).build()
141+
PoolBuilder::from(inner.into()).build()
130142
}
131143
}
132144

0 commit comments

Comments
 (0)