Merge pull request #935 from Some-Dood/deps/prefer-sub-crates
Deps: prefer sub-crates of `futures`
This commit is contained in:
commit
8f955eb3ac
@ -16,12 +16,12 @@ default = ["runtime"]
|
||||
runtime = ["tokio-postgres/runtime"]
|
||||
|
||||
[dependencies]
|
||||
futures = "0.3"
|
||||
native-tls = "0.2"
|
||||
tokio = "1.0"
|
||||
tokio-native-tls = "0.3"
|
||||
tokio-postgres = { version = "0.7.0", path = "../tokio-postgres", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
futures-util = "0.3"
|
||||
tokio = { version = "1.0", features = ["macros", "net", "rt"] }
|
||||
postgres = { version = "0.19.0", path = "../postgres" }
|
||||
|
@ -1,4 +1,4 @@
|
||||
use futures::FutureExt;
|
||||
use futures_util::FutureExt;
|
||||
use native_tls::{self, Certificate};
|
||||
use tokio::net::TcpStream;
|
||||
use tokio_postgres::tls::TlsConnect;
|
||||
|
@ -16,12 +16,12 @@ default = ["runtime"]
|
||||
runtime = ["tokio-postgres/runtime"]
|
||||
|
||||
[dependencies]
|
||||
futures = "0.3"
|
||||
openssl = "0.10"
|
||||
tokio = "1.0"
|
||||
tokio-openssl = "0.6"
|
||||
tokio-postgres = { version = "0.7.0", path = "../tokio-postgres", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
futures-util = "0.3"
|
||||
tokio = { version = "1.0", features = ["macros", "net", "rt"] }
|
||||
postgres = { version = "0.19.0", path = "../postgres" }
|
||||
|
@ -73,6 +73,9 @@ use tokio_postgres::tls::{ChannelBinding, TlsConnect};
|
||||
#[cfg(test)]
|
||||
mod test;
|
||||
|
||||
type ConfigCallback =
|
||||
dyn Fn(&mut ConnectConfiguration, &str) -> Result<(), ErrorStack> + Sync + Send;
|
||||
|
||||
/// A `MakeTlsConnect` implementation using the `openssl` crate.
|
||||
///
|
||||
/// Requires the `runtime` Cargo feature (enabled by default).
|
||||
@ -80,7 +83,7 @@ mod test;
|
||||
#[derive(Clone)]
|
||||
pub struct MakeTlsConnector {
|
||||
connector: SslConnector,
|
||||
config: Arc<dyn Fn(&mut ConnectConfiguration, &str) -> Result<(), ErrorStack> + Sync + Send>,
|
||||
config: Arc<ConfigCallback>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime")]
|
||||
|
@ -1,4 +1,4 @@
|
||||
use futures::FutureExt;
|
||||
use futures_util::FutureExt;
|
||||
use openssl::ssl::{SslConnector, SslMethod};
|
||||
use tokio::net::TcpStream;
|
||||
use tokio_postgres::tls::TlsConnect;
|
||||
|
@ -6,7 +6,7 @@ use std::{i32, i64};
|
||||
use crate::{FromSql, IsNull, ToSql, Type};
|
||||
|
||||
/// A wrapper that can be used to represent infinity with `Type::Date` types.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Date<T> {
|
||||
/// Represents `infinity`, a date that is later than all other dates.
|
||||
PosInfinity,
|
||||
@ -55,7 +55,7 @@ impl<T: ToSql> ToSql for Date<T> {
|
||||
|
||||
/// A wrapper that can be used to represent infinity with `Type::Timestamp` and `Type::Timestamptz`
|
||||
/// types.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Timestamp<T> {
|
||||
/// Represents `infinity`, a timestamp that is later than all other timestamps.
|
||||
PosInfinity,
|
||||
|
@ -37,7 +37,7 @@ with-time-0_3 = ["tokio-postgres/with-time-0_3"]
|
||||
[dependencies]
|
||||
bytes = "1.0"
|
||||
fallible-iterator = "0.2"
|
||||
futures = "0.3"
|
||||
futures-util = { version = "0.3", features = ["sink"] }
|
||||
tokio-postgres = { version = "0.7.6", path = "../tokio-postgres" }
|
||||
|
||||
tokio = { version = "1.0", features = ["rt", "time"] }
|
||||
@ -45,3 +45,4 @@ log = "0.4"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.3"
|
||||
tokio = { version = "1.0", features = ["rt-multi-thread"] }
|
||||
|
@ -4,7 +4,7 @@ use crate::connection::ConnectionRef;
|
||||
use crate::types::{BorrowToSql, ToSql, Type};
|
||||
use crate::{CopyInWriter, CopyOutReader, Error};
|
||||
use fallible_iterator::FallibleIterator;
|
||||
use futures::StreamExt;
|
||||
use futures_util::StreamExt;
|
||||
use std::pin::Pin;
|
||||
#[doc(inline)]
|
||||
pub use tokio_postgres::binary_copy::BinaryCopyOutRow;
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{Error, Notification};
|
||||
use futures::future;
|
||||
use futures::{pin_mut, Stream};
|
||||
use futures_util::{future, pin_mut, Stream};
|
||||
use std::collections::VecDeque;
|
||||
use std::future::Future;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::connection::ConnectionRef;
|
||||
use crate::lazy_pin::LazyPin;
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use futures::SinkExt;
|
||||
use futures_util::SinkExt;
|
||||
use std::io;
|
||||
use std::io::Write;
|
||||
use tokio_postgres::{CopyInSink, Error};
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::connection::ConnectionRef;
|
||||
use crate::lazy_pin::LazyPin;
|
||||
use bytes::{Buf, Bytes};
|
||||
use futures::StreamExt;
|
||||
use futures_util::StreamExt;
|
||||
use std::io::{self, BufRead, Read};
|
||||
use tokio_postgres::CopyOutStream;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
use crate::connection::ConnectionRef;
|
||||
use crate::{Error, Notification};
|
||||
use fallible_iterator::FallibleIterator;
|
||||
use futures::{ready, FutureExt};
|
||||
use futures_util::{ready, FutureExt};
|
||||
use std::pin::Pin;
|
||||
use std::task::Poll;
|
||||
use std::time::Duration;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::connection::ConnectionRef;
|
||||
use fallible_iterator::FallibleIterator;
|
||||
use futures::StreamExt;
|
||||
use futures_util::StreamExt;
|
||||
use std::pin::Pin;
|
||||
use tokio_postgres::{Error, Row, RowStream};
|
||||
|
||||
|
@ -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", "net", "rt", "rt-multi-thread", "time"] }
|
||||
|
||||
bit-vec-06 = { version = "0.6", package = "bit-vec" }
|
||||
chrono-04 = { version = "0.4", package = "chrono", default-features = false }
|
||||
|
@ -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()
|
||||
})
|
||||
});
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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(),
|
||||
|
@ -23,7 +23,7 @@ use std::{error, fmt, iter, mem};
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
/// Properties required of a session.
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
pub enum TargetSessionAttrs {
|
||||
/// No special properties are required.
|
||||
@ -33,7 +33,7 @@ pub enum TargetSessionAttrs {
|
||||
}
|
||||
|
||||
/// TLS configuration.
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
pub enum SslMode {
|
||||
/// Do not use TLS.
|
||||
@ -45,7 +45,7 @@ pub enum SslMode {
|
||||
}
|
||||
|
||||
/// Channel binding configuration.
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
pub enum ChannelBinding {
|
||||
/// Do not use channel binding.
|
||||
@ -57,7 +57,7 @@ pub enum ChannelBinding {
|
||||
}
|
||||
|
||||
/// A host specification.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum Host {
|
||||
/// A TCP hostname.
|
||||
Tcp(String),
|
||||
@ -144,7 +144,7 @@ pub enum Host {
|
||||
/// ```not_rust
|
||||
/// postgresql:///mydb?user=user&host=/var/lib/postgresql
|
||||
/// ```
|
||||
#[derive(PartialEq, Clone)]
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub struct Config {
|
||||
pub(crate) user: Option<String>,
|
||||
pub(crate) password: Option<Vec<u8>>,
|
||||
@ -452,7 +452,7 @@ impl Config {
|
||||
}
|
||||
}
|
||||
"target_session_attrs" => {
|
||||
let target_session_attrs = match &*value {
|
||||
let target_session_attrs = match value {
|
||||
"any" => TargetSessionAttrs::Any,
|
||||
"read-write" => TargetSessionAttrs::ReadWrite,
|
||||
_ => {
|
||||
@ -900,7 +900,7 @@ impl<'a> UrlParser<'a> {
|
||||
#[cfg(unix)]
|
||||
fn host_param(&mut self, s: &str) -> Result<(), Error> {
|
||||
let decoded = Cow::from(percent_encoding::percent_decode(s.as_bytes()));
|
||||
if decoded.get(0) == Some(&b'/') {
|
||||
if decoded.first() == Some(&b'/') {
|
||||
self.config.host_path(OsStr::from_bytes(&decoded));
|
||||
} else {
|
||||
let decoded = str::from_utf8(&decoded).map_err(|e| Error::config_parse(Box::new(e)))?;
|
||||
|
@ -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;
|
||||
|
||||
@ -28,7 +28,7 @@ where
|
||||
let port = config
|
||||
.port
|
||||
.get(i)
|
||||
.or_else(|| config.port.get(0))
|
||||
.or_else(|| config.port.first())
|
||||
.copied()
|
||||
.unwrap_or(5432);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -69,7 +69,7 @@
|
||||
//! combinator):
|
||||
//!
|
||||
//! ```rust
|
||||
//! use futures::future;
|
||||
//! use futures_util::future;
|
||||
//! use std::future::Future;
|
||||
//! use tokio_postgres::{Client, Error, Statement};
|
||||
//!
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user