Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fairly naive update of dependencies. #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "async-postgres"
version = "0.5.1"
version = "0.7.0"
authors = ["Hexilee <[email protected]>"]
edition = "2018"
license = "MIT"
Expand All @@ -21,18 +21,18 @@ codecov = { repository = "Hexilee/async-postgres" }
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
async-std = "1.10"
bytes = "0.5"
tokio-postgres = { version = "0.5", default-features = false }
tokio = "0.2"
async-std = "1.6"
tokio = "1"
tokio-postgres = { version = "0.7", default-features = false, features = ["runtime"] }
futures = { version = "0.3", default-features = false }


[dev-dependencies]
async-std = { version = "1.6", features = ["attributes"] }
tokio = { version = "0.2", features = ["full"] }
tokio-postgres = "0.5"
postgres-native-tls = "0.3"
async-std = { version = "1.10", features = ["attributes"] }
tokio = { version = "1", features = ["full"] }
tokio-postgres = "0.7"
postgres-native-tls = "0.5"
native-tls = "0.2"

[features]
Expand All @@ -41,16 +41,20 @@ full = ["all-types"]
all-types = [
"with-bit-vec-0_6",
Hexilee marked this conversation as resolved.
Show resolved Hide resolved
"with-chrono-0_4",
"with-eui48-0_4",
"with-geo-types-0_4",
"with-eui48-1",
"with-geo-types-0_7",
"with-serde_json-1",
"with-uuid-0_8",
"with-time-0_2"
"with-time-0_3"
]

with-bit-vec-0_6 = ["tokio-postgres/with-bit-vec-0_6"]
with-chrono-0_4 = ["tokio-postgres/with-chrono-0_4"]
with-eui48-0_4 = ["tokio-postgres/with-eui48-0_4"]
with-geo-types-0_4 = ["tokio-postgres/with-geo-types-0_4"]
with-eui48-1 = ["tokio-postgres/with-eui48-1"]
with-geo-types-0_6 = ["tokio-postgres/with-geo-types-0_6"]
with-geo-types-0_7 = ["tokio-postgres/with-geo-types-0_7"]
with-serde_json-1 = ["tokio-postgres/with-serde_json-1"]
with-uuid-0_8 = ["tokio-postgres/with-uuid-0_8"]
with-time-0_2 = ["tokio-postgres/with-time-0_2"]
with-time-0_3 = ["tokio-postgres/with-time-0_3"]
17 changes: 7 additions & 10 deletions src/socket.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use async_std::io::{self, Read, Write};
use std::mem::MaybeUninit;
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::io::{AsyncRead, AsyncWrite};
use futures::ready;
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};

/// A alias for 'static + Unpin + Send + Read + Write
pub trait AsyncReadWriter: 'static + Unpin + Send + Read + Write {}
Expand All @@ -22,18 +22,15 @@ where
}

impl AsyncRead for Socket {
#[inline]
unsafe fn prepare_uninitialized_buffer(&self, _buf: &mut [MaybeUninit<u8>]) -> bool {
false
}

#[inline]
fn poll_read(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &mut [u8],
) -> Poll<io::Result<usize>> {
Pin::new(&mut self.0).poll_read(cx, buf)
buf: &mut ReadBuf<'_>,
Hexilee marked this conversation as resolved.
Show resolved Hide resolved
) -> Poll<io::Result<()>> {
let read_size = ready!(Pin::new(&mut self.0).poll_read(cx, buf.initialize_unfilled()))?;
buf.advance(read_size);
Poll::Ready(Ok(()))
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn benchmark() -> Result<(), Box<dyn Error>> {
let queries = TASKS * QUERIES;
let tcp_url = var("TCP_URL")?;
let uds_url = var("UDS_URL")?;
let mut tokio_rr = tokio::runtime::Runtime::new()?;
let tokio_rr = tokio::runtime::Runtime::new()?;

println!("Benchmark concurrency({}), queries({}):", TASKS, queries);
println!(" - async-postgres on async-std runtime:");
Expand Down