@@ -19,16 +19,18 @@ use crate::{
19
19
use bytes:: { Buf , BytesMut } ;
20
20
use fallible_iterator:: FallibleIterator ;
21
21
use futures_channel:: mpsc;
22
- use futures_util:: { future , pin_mut , ready, StreamExt , TryStreamExt } ;
22
+ use futures_util:: { ready, StreamExt , TryStreamExt } ;
23
23
use parking_lot:: Mutex ;
24
24
use postgres_protocol:: message:: backend:: Message ;
25
25
use postgres_types:: BorrowToSql ;
26
26
use std:: collections:: HashMap ;
27
27
use std:: fmt;
28
+ use std:: future;
28
29
#[ cfg( feature = "runtime" ) ]
29
30
use std:: net:: IpAddr ;
30
31
#[ cfg( feature = "runtime" ) ]
31
32
use std:: path:: PathBuf ;
33
+ use std:: pin:: pin;
32
34
use std:: sync:: Arc ;
33
35
use std:: task:: { Context , Poll } ;
34
36
#[ cfg( feature = "runtime" ) ]
@@ -300,8 +302,7 @@ impl Client {
300
302
where
301
303
T : ?Sized + ToStatement ,
302
304
{
303
- let stream = self . query_raw ( statement, slice_iter ( params) ) . await ?;
304
- pin_mut ! ( stream) ;
305
+ let mut stream = pin ! ( self . query_raw( statement, slice_iter( params) ) . await ?) ;
305
306
306
307
let mut first = None ;
307
308
@@ -336,18 +337,18 @@ impl Client {
336
337
///
337
338
/// ```no_run
338
339
/// # async fn async_main(client: &tokio_postgres::Client) -> Result<(), tokio_postgres::Error> {
339
- /// use futures_util::{pin_mut, TryStreamExt};
340
+ /// use std::pin::pin;
341
+ /// use futures_util::TryStreamExt;
340
342
///
341
343
/// let params: Vec<String> = vec![
342
344
/// "first param".into(),
343
345
/// "second param".into(),
344
346
/// ];
345
- /// let mut it = client.query_raw(
347
+ /// let mut it = pin!( client.query_raw(
346
348
/// "SELECT foo FROM bar WHERE biz = $1 AND baz = $2",
347
349
/// params,
348
- /// ).await?;
350
+ /// ).await?) ;
349
351
///
350
- /// pin_mut!(it);
351
352
/// while let Some(row) = it.try_next().await? {
352
353
/// let foo: i32 = row.get("foo");
353
354
/// println!("foo: {}", foo);
@@ -402,19 +403,19 @@ impl Client {
402
403
///
403
404
/// ```no_run
404
405
/// # async fn async_main(client: &tokio_postgres::Client) -> Result<(), tokio_postgres::Error> {
405
- /// use futures_util::{pin_mut, TryStreamExt};
406
+ /// use std::pin::pin;
407
+ /// use futures_util::{TryStreamExt};
406
408
/// use tokio_postgres::types::Type;
407
409
///
408
410
/// let params: Vec<(String, Type)> = vec![
409
411
/// ("first param".into(), Type::TEXT),
410
412
/// ("second param".into(), Type::TEXT),
411
413
/// ];
412
- /// let mut it = client.query_typed_raw(
414
+ /// let mut it = pin!( client.query_typed_raw(
413
415
/// "SELECT foo FROM bar WHERE biz = $1 AND baz = $2",
414
416
/// params,
415
- /// ).await?;
417
+ /// ).await?) ;
416
418
///
417
- /// pin_mut!(it);
418
419
/// while let Some(row) = it.try_next().await? {
419
420
/// let foo: i32 = row.get("foo");
420
421
/// println!("foo: {}", foo);
0 commit comments