Chore(tokio-postgres): prefer sub-crates of futures

This commit is contained in:
Basti Ortiz 2022-08-14 23:31:17 +08:00
parent a624282bed
commit 65c1d146a6
No known key found for this signature in database
GPG Key ID: 1402D5CB17F48E1B
17 changed files with 29 additions and 30 deletions

View File

@ -45,7 +45,8 @@ async-trait = "0.1"
bytes = "1.0"
byteorder = "1.0"
fallible-iterator = "0.2"
futures = "0.3"
futures-channel = { version = "0.3", features = ["sink"] }
futures-util = { version = "0.3", features = ["sink"] }
log = "0.4"
parking_lot = "0.12"
percent-encoding = "2.0"
@ -58,9 +59,10 @@ tokio = { version = "1.0", features = ["io-util"] }
tokio-util = { version = "0.7", features = ["codec"] }
[dev-dependencies]
tokio = { version = "1.0", features = ["full"] }
env_logger = "0.9"
futures-executor = "0.3"
criterion = "0.3"
env_logger = "0.9"
tokio = { version = "1.0", features = ["macros", "rt"] }
bit-vec-06 = { version = "0.6", package = "bit-vec" }
chrono-04 = { version = "0.4", package = "chrono", default-features = false }

View File

@ -1,6 +1,5 @@
use criterion::{criterion_group, criterion_main, Criterion};
use futures::channel::oneshot;
use futures::executor;
use futures_channel::oneshot;
use std::sync::Arc;
use std::time::Instant;
use tokio::runtime::Runtime;
@ -32,7 +31,7 @@ fn query_prepared(c: &mut Criterion) {
let (client, runtime) = setup();
let statement = runtime.block_on(client.prepare("SELECT $1::INT8")).unwrap();
c.bench_function("executor_block_on", move |b| {
b.iter(|| executor::block_on(client.query(&statement, &[&1i64])).unwrap())
b.iter(|| futures_executor::block_on(client.query(&statement, &[&1i64])).unwrap())
});
let (client, runtime) = setup();
@ -50,7 +49,7 @@ fn query_prepared(c: &mut Criterion) {
}
tx.send(start.elapsed()).unwrap();
});
executor::block_on(rx).unwrap()
futures_executor::block_on(rx).unwrap()
})
});
}

View File

@ -4,7 +4,7 @@ use crate::types::{FromSql, IsNull, ToSql, Type, WrongType};
use crate::{slice_iter, CopyInSink, CopyOutStream, Error};
use byteorder::{BigEndian, ByteOrder};
use bytes::{Buf, BufMut, Bytes, BytesMut};
use futures::{ready, SinkExt, Stream};
use futures_util::{ready, SinkExt, Stream};
use pin_project_lite::pin_project;
use postgres_types::BorrowToSql;
use std::convert::TryFrom;

View File

@ -18,8 +18,8 @@ use crate::{
};
use bytes::{Buf, BytesMut};
use fallible_iterator::FallibleIterator;
use futures::channel::mpsc;
use futures::{future, pin_mut, ready, StreamExt, TryStreamExt};
use futures_channel::mpsc;
use futures_util::{future, pin_mut, ready, StreamExt, TryStreamExt};
use parking_lot::Mutex;
use postgres_protocol::message::{backend::Message, frontend};
use postgres_types::BorrowToSql;
@ -341,7 +341,7 @@ impl Client {
/// ```no_run
/// # async fn async_main(client: &tokio_postgres::Client) -> Result<(), tokio_postgres::Error> {
/// use tokio_postgres::types::ToSql;
/// use futures::{pin_mut, TryStreamExt};
/// use futures_util::{pin_mut, TryStreamExt};
///
/// let params: Vec<String> = vec![
/// "first param".into(),

View File

@ -4,7 +4,7 @@ use crate::connect_raw::connect_raw;
use crate::connect_socket::connect_socket;
use crate::tls::{MakeTlsConnect, TlsConnect};
use crate::{Client, Config, Connection, Error, SimpleQueryMessage, Socket};
use futures::{future, pin_mut, Future, FutureExt, Stream};
use futures_util::{future, pin_mut, Future, FutureExt, Stream};
use std::io;
use std::task::Poll;

View File

@ -6,8 +6,8 @@ use crate::tls::{TlsConnect, TlsStream};
use crate::{Client, Connection, Error};
use bytes::BytesMut;
use fallible_iterator::FallibleIterator;
use futures::channel::mpsc;
use futures::{ready, Sink, SinkExt, Stream, TryStreamExt};
use futures_channel::mpsc;
use futures_util::{ready, Sink, SinkExt, Stream, TryStreamExt};
use postgres_protocol::authentication;
use postgres_protocol::authentication::sasl;
use postgres_protocol::authentication::sasl::ScramSha256;

View File

@ -5,9 +5,8 @@ use crate::maybe_tls_stream::MaybeTlsStream;
use crate::{AsyncMessage, Error, Notification};
use bytes::BytesMut;
use fallible_iterator::FallibleIterator;
use futures::channel::mpsc;
use futures::stream::FusedStream;
use futures::{ready, Sink, Stream, StreamExt};
use futures_channel::mpsc;
use futures_util::{ready, stream::FusedStream, Sink, Stream, StreamExt};
use log::{info, trace};
use postgres_protocol::message::backend::Message;
use postgres_protocol::message::frontend;

View File

@ -3,9 +3,8 @@ use crate::codec::FrontendMessage;
use crate::connection::RequestMessages;
use crate::{query, slice_iter, Error, Statement};
use bytes::{Buf, BufMut, BytesMut};
use futures::channel::mpsc;
use futures::future;
use futures::{ready, Sink, SinkExt, Stream, StreamExt};
use futures_channel::mpsc;
use futures_util::{future, ready, Sink, SinkExt, Stream, StreamExt};
use log::debug;
use pin_project_lite::pin_project;
use postgres_protocol::message::backend::Message;

View File

@ -3,7 +3,7 @@ use crate::codec::FrontendMessage;
use crate::connection::RequestMessages;
use crate::{query, slice_iter, Error, Statement};
use bytes::Bytes;
use futures::{ready, Stream};
use futures_util::{ready, Stream};
use log::debug;
use pin_project_lite::pin_project;
use postgres_protocol::message::backend::Message;

View File

@ -69,7 +69,7 @@
//! combinator):
//!
//! ```rust
//! use futures::future;
//! use futures_util::future;
//! use std::future::Future;
//! use tokio_postgres::{Client, Error, Statement};
//!

View File

@ -7,7 +7,7 @@ use crate::{query, slice_iter};
use crate::{Column, Error, Statement};
use bytes::Bytes;
use fallible_iterator::FallibleIterator;
use futures::{pin_mut, TryStreamExt};
use futures_util::{pin_mut, TryStreamExt};
use log::debug;
use postgres_protocol::message::backend::Message;
use postgres_protocol::message::frontend;

View File

@ -4,7 +4,7 @@ use crate::connection::RequestMessages;
use crate::types::{BorrowToSql, IsNull};
use crate::{Error, Portal, Row, Statement};
use bytes::{Bytes, BytesMut};
use futures::{ready, Stream};
use futures_util::{ready, Stream};
use log::{debug, log_enabled, Level};
use pin_project_lite::pin_project;
use postgres_protocol::message::backend::Message;

View File

@ -4,7 +4,7 @@ use crate::connection::RequestMessages;
use crate::{Error, SimpleQueryMessage, SimpleQueryRow};
use bytes::Bytes;
use fallible_iterator::FallibleIterator;
use futures::{ready, Stream};
use futures_util::{ready, Stream};
use log::debug;
use pin_project_lite::pin_project;
use postgres_protocol::message::backend::Message;

View File

@ -13,7 +13,7 @@ use crate::{
SimpleQueryMessage, Statement, ToStatement,
};
use bytes::Buf;
use futures::TryStreamExt;
use futures_util::TryStreamExt;
use postgres_protocol::message::frontend;
use tokio::io::{AsyncRead, AsyncWrite};

View File

@ -1,5 +1,5 @@
use crate::connect;
use futures::{pin_mut, TryStreamExt};
use futures_util::{pin_mut, TryStreamExt};
use tokio_postgres::binary_copy::{BinaryCopyInWriter, BinaryCopyOutStream};
use tokio_postgres::types::Type;

View File

@ -1,8 +1,8 @@
#![warn(rust_2018_idioms)]
use bytes::{Bytes, BytesMut};
use futures::channel::mpsc;
use futures::{
use futures_channel::mpsc;
use futures_util::{
future, join, pin_mut, stream, try_join, Future, FutureExt, SinkExt, StreamExt, TryStreamExt,
};
use pin_project_lite::pin_project;

View File

@ -1,4 +1,4 @@
use futures::{join, FutureExt};
use futures_util::{join, FutureExt};
use std::time::Duration;
use tokio::time;
use tokio_postgres::error::SqlState;