Merge pull request #16 from smol-rs/taiki-e/owned

Use Async::{readable_owned, writable_owned}
This commit is contained in:
Taiki Endo 2021-06-30 21:44:55 +09:00 committed by GitHub
commit a5b175921b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View File

@ -15,7 +15,7 @@ keywords = ["networking", "uds", "mio", "reactor", "std"]
categories = ["asynchronous", "network-programming", "os"]
[dependencies]
async-io = "1.5.0"
async-io = "1.6.0"
blocking = "1.0.0"
fastrand = "1.3.5"
futures-lite = "1.11.0"

View File

@ -303,8 +303,8 @@ impl fmt::Debug for Incoming<'_> {
/// ```
pub struct TcpStream {
inner: Arc<Async<std::net::TcpStream>>,
readable: Option<async_io::Readable>,
writable: Option<async_io::Writable>,
readable: Option<async_io::ReadableOwned<std::net::TcpStream>>,
writable: Option<async_io::WritableOwned<std::net::TcpStream>>,
}
impl UnwindSafe for TcpStream {}
@ -599,7 +599,7 @@ impl AsyncRead for TcpStream {
// Initialize the future to wait for readiness.
if self.readable.is_none() {
self.readable = Some(self.inner.readable());
self.readable = Some(self.inner.clone().readable_owned());
}
// Poll the future for readiness.
@ -630,7 +630,7 @@ impl AsyncWrite for TcpStream {
// Initialize the future to wait for readiness.
if self.writable.is_none() {
self.writable = Some(self.inner.writable());
self.writable = Some(self.inner.clone().writable_owned());
}
// Poll the future for readiness.
@ -655,7 +655,7 @@ impl AsyncWrite for TcpStream {
// Initialize the future to wait for readiness.
if self.writable.is_none() {
self.writable = Some(self.inner.writable());
self.writable = Some(self.inner.clone().writable_owned());
}
// Poll the future for readiness.
@ -688,7 +688,7 @@ impl AsyncWrite for TcpStream {
// Initialize the future to wait for readiness.
if self.writable.is_none() {
self.writable = Some(self.inner.writable());
self.writable = Some(self.inner.clone().writable_owned());
}
// Poll the future for readiness.

View File

@ -234,8 +234,8 @@ impl fmt::Debug for Incoming<'_> {
/// ```
pub struct UnixStream {
inner: Arc<Async<std::os::unix::net::UnixStream>>,
readable: Option<async_io::Readable>,
writable: Option<async_io::Writable>,
readable: Option<async_io::ReadableOwned<std::os::unix::net::UnixStream>>,
writable: Option<async_io::WritableOwned<std::os::unix::net::UnixStream>>,
}
impl UnwindSafe for UnixStream {}
@ -396,7 +396,7 @@ impl AsyncRead for UnixStream {
// Initialize the future to wait for readiness.
if self.readable.is_none() {
self.readable = Some(self.inner.readable());
self.readable = Some(self.inner.clone().readable_owned());
}
// Poll the future for readiness.
@ -427,7 +427,7 @@ impl AsyncWrite for UnixStream {
// Initialize the future to wait for readiness.
if self.writable.is_none() {
self.writable = Some(self.inner.writable());
self.writable = Some(self.inner.clone().writable_owned());
}
// Poll the future for readiness.
@ -452,7 +452,7 @@ impl AsyncWrite for UnixStream {
// Initialize the future to wait for readiness.
if self.writable.is_none() {
self.writable = Some(self.inner.writable());
self.writable = Some(self.inner.clone().writable_owned());
}
// Poll the future for readiness.