1+ use std:: task:: { Context , Poll } ;
12use std:: time:: Duration ;
2- use std:: task:: { Poll , Context } ;
3- use std:: { pin:: Pin , future:: Future , io} ;
3+ use std:: { future:: Future , io, pin:: Pin } ;
44
55use lever:: prelude:: * ;
66use once_cell:: sync:: Lazy ;
@@ -9,6 +9,9 @@ use super::syscore::*;
99use super :: waker:: * ;
1010use crate :: spawn_blocking;
1111
12+ #[ cfg( target_os = "windows" ) ]
13+ use crate :: syscore:: iocp:: SysProactor ;
14+
1215pub use super :: handle:: * ;
1316
1417///
@@ -18,9 +21,8 @@ pub struct Proactor(SysProactor);
1821impl Proactor {
1922 /// Returns a reference to the proactor.
2023 pub fn get ( ) -> & ' static Proactor {
21- static PROACTOR : Lazy < Proactor > = Lazy :: new ( || Proactor (
22- SysProactor :: new ( ) . expect ( "cannot initialize poll backend" )
23- ) ) ;
24+ static PROACTOR : Lazy < Proactor > =
25+ Lazy :: new ( || Proactor ( SysProactor :: new ( ) . expect ( "cannot initialize poll backend" ) ) ) ;
2426
2527 & PROACTOR
2628 }
@@ -52,10 +54,8 @@ pub fn drive<T>(future: impl Future<Output = T>) -> T {
5254 let cx = & mut Context :: from_waker ( & waker) ;
5355 futures_util:: pin_mut!( future) ;
5456
55- let driver = spawn_blocking ( move || {
56- loop {
57- let _ = p. wait ( 1 , None ) ;
58- }
57+ let driver = spawn_blocking ( move || loop {
58+ let _ = p. wait ( 1 , None ) ;
5959 } ) ;
6060
6161 futures_util:: pin_mut!( driver) ;
@@ -70,4 +70,4 @@ pub fn drive<T>(future: impl Future<Output = T>) -> T {
7070 let duration = Duration :: from_millis ( 1 ) ;
7171 driver. as_mut ( ) . poll ( cx) ;
7272 }
73- }
73+ }
0 commit comments