Skip to content

Commit 72114ac

Browse files
committed
hyper 0.13 -> 0.14, tonic 0.2 -> 1.0
1 parent 56bc5ef commit 72114ac

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ license = "ISC"
1010

1111
[dependencies]
1212
anyhow = "1.0"
13-
futures-util = "0.3.1"
13+
futures-util = "0.3"
1414
hex = "0.4"
15-
hyper = { version = "0.13", features = ["stream"] }
16-
tokio = { version = "0.2", features = ["uds"] }
17-
pin-project = "0.4"
15+
hyper = { version = "0.14", features = ["full"] }
16+
tokio = { version = "1.0", features = ["net", "rt-multi-thread"] }
17+
pin-project = "1.0"

src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ use core::{
1010
pin::Pin,
1111
task::{Context, Poll},
1212
};
13-
use futures_util::future::{FutureExt, TryFutureExt};
1413
use hex::FromHex;
1514
use pin_project::pin_project;
1615
use std::borrow::Cow;
1716
use std::future::Future;
1817
use std::path::Path;
18+
use tokio::io::ReadBuf;
1919

2020
/// A type which implements `Into` for hyper's [`hyper::Uri`] type
2121
/// targetting unix domain sockets.
@@ -120,16 +120,14 @@ impl hyper::server::accept::Accept for UnixConnector {
120120
type Error = Error;
121121

122122
fn poll_accept(
123-
mut self: Pin<&mut Self>,
123+
self: Pin<&mut Self>,
124124
cx: &mut Context,
125125
) -> Poll<Option<Result<Self::Conn, Self::Error>>> {
126-
let fut = self
127-
.0
128-
.accept()
126+
self.0
127+
.poll_accept(cx)
129128
.map_ok(|(stream, _addr)| stream)
130129
.map_err(|e| e.into())
131-
.map(|f| Some(f));
132-
Future::poll(Box::pin(fut).as_mut(), cx)
130+
.map(|f| Some(f))
133131
}
134132
}
135133

@@ -160,7 +158,7 @@ macro_rules! conn_impl_fn {
160158
}
161159

162160
impl tokio::io::AsyncRead for UDS {
163-
conn_impl_fn!(poll_read |self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8]| -> Poll<std::io::Result<usize>> ;;);
161+
conn_impl_fn!(poll_read |self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>| -> Poll<std::io::Result<()>> ;;);
164162
}
165163

166164
impl tokio::io::AsyncWrite for UDS {
@@ -235,7 +233,9 @@ mod test {
235233

236234
std::fs::remove_file(TEST_UNIX_ADDR).unwrap_or_else(|_| ());
237235

238-
let mut rt = tokio::runtime::Runtime::new()?;
236+
let rt = tokio::runtime::Builder::new_multi_thread()
237+
.enable_all()
238+
.build()?;
239239
rt.block_on(async {
240240
// server
241241
let uc: UnixConnector = tokio::net::UnixListener::bind(TEST_UNIX_ADDR)

0 commit comments

Comments
 (0)