@@ -19,16 +19,18 @@ use crate::{
1919use bytes:: { Buf , BytesMut } ;
2020use fallible_iterator:: FallibleIterator ;
2121use futures_channel:: mpsc;
22- use futures_util:: { future , pin_mut , ready, StreamExt , TryStreamExt } ;
22+ use futures_util:: { ready, StreamExt , TryStreamExt } ;
2323use parking_lot:: Mutex ;
2424use postgres_protocol:: message:: backend:: Message ;
2525use postgres_types:: BorrowToSql ;
2626use std:: collections:: HashMap ;
2727use std:: fmt;
28+ use std:: future;
2829#[ cfg( feature = "runtime" ) ]
2930use std:: net:: IpAddr ;
3031#[ cfg( feature = "runtime" ) ]
3132use std:: path:: PathBuf ;
33+ use std:: pin:: pin;
3234use std:: sync:: Arc ;
3335use std:: task:: { Context , Poll } ;
3436#[ cfg( feature = "runtime" ) ]
@@ -300,8 +302,7 @@ impl Client {
300302 where
301303 T : ?Sized + ToStatement ,
302304 {
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 ?) ;
305306
306307 let mut first = None ;
307308
@@ -336,18 +337,18 @@ impl Client {
336337 ///
337338 /// ```no_run
338339 /// # 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;
340342 ///
341343 /// let params: Vec<String> = vec![
342344 /// "first param".into(),
343345 /// "second param".into(),
344346 /// ];
345- /// let mut it = client.query_raw(
347+ /// let mut it = pin!( client.query_raw(
346348 /// "SELECT foo FROM bar WHERE biz = $1 AND baz = $2",
347349 /// params,
348- /// ).await?;
350+ /// ).await?) ;
349351 ///
350- /// pin_mut!(it);
351352 /// while let Some(row) = it.try_next().await? {
352353 /// let foo: i32 = row.get("foo");
353354 /// println!("foo: {}", foo);
@@ -402,19 +403,19 @@ impl Client {
402403 ///
403404 /// ```no_run
404405 /// # 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};
406408 /// use tokio_postgres::types::Type;
407409 ///
408410 /// let params: Vec<(String, Type)> = vec![
409411 /// ("first param".into(), Type::TEXT),
410412 /// ("second param".into(), Type::TEXT),
411413 /// ];
412- /// let mut it = client.query_typed_raw(
414+ /// let mut it = pin!( client.query_typed_raw(
413415 /// "SELECT foo FROM bar WHERE biz = $1 AND baz = $2",
414416 /// params,
415- /// ).await?;
417+ /// ).await?) ;
416418 ///
417- /// pin_mut!(it);
418419 /// while let Some(row) = it.try_next().await? {
419420 /// let foo: i32 = row.get("foo");
420421 /// println!("foo: {}", foo);
0 commit comments