mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
Replace some futures_util APIs with std variants (#3721)
This commit is contained in:
@@ -5,7 +5,7 @@ use crate::{
|
||||
use futures_core::future::BoxFuture;
|
||||
use futures_core::stream::BoxStream;
|
||||
use futures_util::{stream, StreamExt, TryFutureExt, TryStreamExt};
|
||||
use std::future;
|
||||
use std::{future, pin::pin};
|
||||
|
||||
use sqlx_core::any::{
|
||||
Any, AnyArguments, AnyColumn, AnyConnectOptions, AnyConnectionBackend, AnyQueryResult, AnyRow,
|
||||
@@ -115,8 +115,7 @@ impl AnyConnectionBackend for PgConnection {
|
||||
|
||||
Box::pin(async move {
|
||||
let arguments = arguments?;
|
||||
let stream = self.run(query, arguments, 1, persistent, None).await?;
|
||||
futures_util::pin_mut!(stream);
|
||||
let mut stream = pin!(self.run(query, arguments, 1, persistent, None).await?);
|
||||
|
||||
if let Some(Either::Right(row)) = stream.try_next().await? {
|
||||
return Ok(Some(AnyRow::try_from(&row)?));
|
||||
|
||||
@@ -15,10 +15,10 @@ use crate::{
|
||||
use futures_core::future::BoxFuture;
|
||||
use futures_core::stream::BoxStream;
|
||||
use futures_core::Stream;
|
||||
use futures_util::{pin_mut, TryStreamExt};
|
||||
use futures_util::TryStreamExt;
|
||||
use sqlx_core::arguments::Arguments;
|
||||
use sqlx_core::Either;
|
||||
use std::{borrow::Cow, sync::Arc};
|
||||
use std::{borrow::Cow, pin::pin, sync::Arc};
|
||||
|
||||
async fn prepare(
|
||||
conn: &mut PgConnection,
|
||||
@@ -393,8 +393,7 @@ impl<'c> Executor<'c> for &'c mut PgConnection {
|
||||
|
||||
Box::pin(try_stream! {
|
||||
let arguments = arguments?;
|
||||
let s = self.run(sql, arguments, 0, persistent, metadata).await?;
|
||||
pin_mut!(s);
|
||||
let mut s = pin!(self.run(sql, arguments, 0, persistent, metadata).await?);
|
||||
|
||||
while let Some(v) = s.try_next().await? {
|
||||
r#yield!(v);
|
||||
@@ -420,8 +419,7 @@ impl<'c> Executor<'c> for &'c mut PgConnection {
|
||||
|
||||
Box::pin(async move {
|
||||
let arguments = arguments?;
|
||||
let s = self.run(sql, arguments, 1, persistent, metadata).await?;
|
||||
pin_mut!(s);
|
||||
let mut s = pin!(self.run(sql, arguments, 1, persistent, metadata).await?);
|
||||
|
||||
// With deferred constraints we need to check all responses as we
|
||||
// could get a OK response (with uncommitted data), only to get an
|
||||
|
||||
Reference in New Issue
Block a user