File tree Expand file tree Collapse file tree 8 files changed +20
-18
lines changed Expand file tree Collapse file tree 8 files changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ rustdoc-args = ["--cfg", "feature=\"docs\""]
2424[features ]
2525default = [
2626 " std" ,
27+ " async-io" ,
2728 " async-task" ,
2829 " kv-log-macro" ,
2930 " log" ,
@@ -77,6 +78,7 @@ futures-timer = { version = "3.0.2", optional = true }
7778surf = { version = " 1.0.3" , optional = true }
7879
7980[target .'cfg(not(target_os = "unknown"))' .dependencies ]
81+ async-io = { version = " 0.1.5" , optional = true }
8082smol = { version = " 0.1.17" , optional = true }
8183
8284[target .'cfg(target_arch = "wasm32")' .dependencies ]
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use std::future::Future;
22use std:: net:: SocketAddr ;
33use std:: pin:: Pin ;
44
5- use smol :: Async ;
5+ use async_io :: Async ;
66
77use crate :: io;
88use crate :: net:: { TcpStream , ToSocketAddrs } ;
@@ -81,7 +81,7 @@ impl TcpListener {
8181 let addrs = addrs. to_socket_addrs ( ) . await ?;
8282
8383 for addr in addrs {
84- match Async :: < std:: net:: TcpListener > :: bind ( & addr) {
84+ match Async :: < std:: net:: TcpListener > :: bind ( addr) {
8585 Ok ( listener) => {
8686 return Ok ( TcpListener { watcher : listener } ) ;
8787 }
@@ -227,7 +227,7 @@ cfg_unix! {
227227
228228 impl IntoRawFd for TcpListener {
229229 fn into_raw_fd( self ) -> RawFd {
230- self . watcher. into_raw_fd( )
230+ self . watcher. into_inner ( ) . unwrap ( ) . into_raw_fd( )
231231 }
232232 }
233233}
@@ -251,7 +251,7 @@ cfg_windows! {
251251
252252 impl IntoRawSocket for TcpListener {
253253 fn into_raw_socket( self ) -> RawSocket {
254- self . watcher. into_raw_socket( )
254+ self . watcher. into_inner ( ) . unwrap ( ) . into_raw_socket( )
255255 }
256256 }
257257}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use std::io::{IoSlice, IoSliceMut};
22use std:: net:: SocketAddr ;
33use std:: pin:: Pin ;
44
5- use smol :: Async ;
5+ use async_io :: Async ;
66
77use crate :: io:: { self , Read , Write } ;
88use crate :: net:: ToSocketAddrs ;
@@ -77,7 +77,7 @@ impl TcpStream {
7777 let addrs = addrs. to_socket_addrs ( ) . await ?;
7878
7979 for addr in addrs {
80- match Async :: < std:: net:: TcpStream > :: connect ( & addr) . await {
80+ match Async :: < std:: net:: TcpStream > :: connect ( addr) . await {
8181 Ok ( stream) => {
8282 return Ok ( TcpStream {
8383 watcher : Arc :: new ( stream) ,
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use std::io;
22use std:: net:: SocketAddr ;
33use std:: net:: { Ipv4Addr , Ipv6Addr } ;
44
5- use smol :: Async ;
5+ use async_io :: Async ;
66
77use crate :: net:: ToSocketAddrs ;
88use crate :: utils:: Context as _;
@@ -74,7 +74,7 @@ impl UdpSocket {
7474 let addrs = addrs. to_socket_addrs ( ) . await ?;
7575
7676 for addr in addrs {
77- match Async :: < std:: net:: UdpSocket > :: bind ( & addr) {
77+ match Async :: < std:: net:: UdpSocket > :: bind ( addr) {
7878 Ok ( socket) => {
7979 return Ok ( UdpSocket { watcher : socket } ) ;
8080 }
@@ -506,7 +506,7 @@ cfg_unix! {
506506
507507 impl IntoRawFd for UdpSocket {
508508 fn into_raw_fd( self ) -> RawFd {
509- self . watcher. into_raw_fd( )
509+ self . watcher. into_inner ( ) . unwrap ( ) . into_raw_fd( )
510510 }
511511 }
512512}
@@ -530,7 +530,7 @@ cfg_windows! {
530530
531531 impl IntoRawSocket for UdpSocket {
532532 fn into_raw_socket( self ) -> RawSocket {
533- self . watcher. into_raw_socket( )
533+ self . watcher. into_inner ( ) . unwrap ( ) . into_raw_socket( )
534534 }
535535 }
536536}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ use std::fmt;
44use std:: net:: Shutdown ;
55use std:: os:: unix:: net:: UnixDatagram as StdUnixDatagram ;
66
7- use smol :: Async ;
7+ use async_io :: Async ;
88
99use super :: SocketAddr ;
1010use crate :: io;
@@ -335,6 +335,6 @@ impl FromRawFd for UnixDatagram {
335335
336336impl IntoRawFd for UnixDatagram {
337337 fn into_raw_fd ( self ) -> RawFd {
338- self . watcher . into_raw_fd ( )
338+ self . watcher . into_inner ( ) . unwrap ( ) . into_raw_fd ( )
339339 }
340340}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use std::future::Future;
55use std:: os:: unix:: net:: UnixListener as StdUnixListener ;
66use std:: pin:: Pin ;
77
8- use smol :: Async ;
8+ use async_io :: Async ;
99
1010use super :: SocketAddr ;
1111use super :: UnixStream ;
@@ -217,6 +217,6 @@ impl FromRawFd for UnixListener {
217217
218218impl IntoRawFd for UnixListener {
219219 fn into_raw_fd ( self ) -> RawFd {
220- self . watcher . into_raw_fd ( )
220+ self . watcher . into_inner ( ) . unwrap ( ) . into_raw_fd ( )
221221 }
222222}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use std::net::Shutdown;
55use std:: os:: unix:: net:: UnixStream as StdUnixStream ;
66use std:: pin:: Pin ;
77
8- use smol :: Async ;
8+ use async_io :: Async ;
99
1010use super :: SocketAddr ;
1111use crate :: io:: { self , Read , Write } ;
Original file line number Diff line number Diff line change @@ -61,15 +61,15 @@ pub(crate) trait Context {
6161
6262#[ cfg( all( not( target_os = "unknown" ) , feature = "default" ) ) ]
6363mod timer {
64- pub type Timer = smol :: Timer ;
64+ pub type Timer = async_io :: Timer ;
6565}
6666
6767#[ cfg( any( feature = "unstable" , feature = "default" ) ) ]
6868pub ( crate ) fn timer_after ( dur : std:: time:: Duration ) -> timer:: Timer {
6969 #[ cfg( all( not( target_os = "unknown" ) , feature = "default" ) ) ]
7070 once_cell:: sync:: Lazy :: force ( & crate :: rt:: RUNTIME ) ;
7171
72- Timer :: after ( dur)
72+ Timer :: new ( dur)
7373}
7474
7575#[ cfg( any(
@@ -84,7 +84,7 @@ mod timer {
8484 pub ( crate ) struct Timer ( futures_timer:: Delay ) ;
8585
8686 impl Timer {
87- pub ( crate ) fn after ( dur : std:: time:: Duration ) -> Self {
87+ pub ( crate ) fn new ( dur : std:: time:: Duration ) -> Self {
8888 Timer ( futures_timer:: Delay :: new ( dur) )
8989 }
9090 }
You can’t perform that action at this time.
0 commit comments