diff --git a/Cargo.toml b/Cargo.toml index 0863d5eb..0665ae23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ serde = { version = "^1.0", features = ["derive"] } serde_json = { version = "^1", optional = true } sqlx = { version = "^0.5", optional = true } uuid = { version = "0.8", features = ["serde", "v4"], optional = true } -ouroboros = { git = "https://github.com/sebpuetz/ouroboros", branch = "send-builder-functions" } +ouroboros = "0.14" url = "^2.2" once_cell = "1.8" diff --git a/src/database/stream/transaction.rs b/src/database/stream/transaction.rs index d198f54f..ad1c8181 100644 --- a/src/database/stream/transaction.rs +++ b/src/database/stream/transaction.rs @@ -2,7 +2,7 @@ use std::{ops::DerefMut, pin::Pin, task::Poll}; -use futures::{FutureExt, Stream}; +use futures::Stream; #[cfg(feature = "sqlx-dep")] use futures::TryStreamExt; @@ -33,16 +33,18 @@ impl<'a> std::fmt::Debug for TransactionStream<'a> { } } -type PinStream<'s> = Pin> + Send + 's>>; - impl<'a> TransactionStream<'a> { - fn stream_builder<'s>( - conn: &'s mut MutexGuard<'a, InnerConnection>, - stmt: &'s Statement, - _metric_callback: &'s Option, - ) -> Pin> + 's + Send>> { - async move { - match conn.deref_mut() { + #[instrument(level = "trace", skip(metric_callback))] + pub(crate) fn build( + conn: MutexGuard<'a, InnerConnection>, + stmt: Statement, + metric_callback: Option, + ) -> TransactionStream<'a> { + TransactionStreamBuilder { + stmt, + conn, + metric_callback, + stream_builder: |conn, stmt, _metric_callback| match conn.deref_mut() { #[cfg(feature = "sqlx-mysql")] InnerConnection::MySql(c) => { let query = crate::driver::sqlx_mysql::sqlx_query(stmt); @@ -81,27 +83,9 @@ impl<'a> TransactionStream<'a> { } #[cfg(feature = "mock")] InnerConnection::Mock(c) => c.fetch(stmt), - } - } - .boxed() - } - - #[instrument(level = "trace", skip(metric_callback))] - pub(crate) async fn build( - conn: MutexGuard<'a, InnerConnection>, - stmt: Statement, - metric_callback: Option, - ) -> TransactionStream<'a> { - let stream_builder = Self::stream_builder; - - TransactionStreamAsyncBuilder { - stmt, - conn, - metric_callback, - stream_builder, + }, } .build() - .await } } diff --git a/src/database/transaction.rs b/src/database/transaction.rs index c8690cb0..80db1c37 100644 --- a/src/database/transaction.rs +++ b/src/database/transaction.rs @@ -361,8 +361,7 @@ impl<'a> ConnectionTrait<'a> for DatabaseTransaction { conn, stmt, self.metric_callback.clone(), - ) - .await) + )) }) }