@@ -48,9 +48,10 @@ use std::os::windows::fs::OpenOptionsExt as _;
48
48
49
49
use async_lock:: Mutex ;
50
50
use blocking:: { unblock, Unblock } ;
51
+ use futures_lite:: future:: FutureExt ;
51
52
use futures_lite:: io:: { AsyncRead , AsyncSeek , AsyncWrite , AsyncWriteExt } ;
53
+ use futures_lite:: ready;
52
54
use futures_lite:: stream:: Stream ;
53
- use futures_lite:: { future, ready} ;
54
55
55
56
#[ doc( no_inline) ]
56
57
pub use std:: fs:: { FileType , Metadata , Permissions } ;
@@ -282,7 +283,7 @@ pub struct ReadDir(State);
282
283
/// The `ReadDir` can be either idle or busy performing an asynchronous operation.
283
284
enum State {
284
285
Idle ( Option < std:: fs:: ReadDir > ) ,
285
- Busy ( future :: Boxed < ( std:: fs:: ReadDir , Option < io:: Result < std:: fs:: DirEntry > > ) > ) ,
286
+ Busy ( blocking :: Task < ( std:: fs:: ReadDir , Option < io:: Result < std:: fs:: DirEntry > > ) > ) ,
286
287
}
287
288
288
289
impl fmt:: Debug for ReadDir {
@@ -301,14 +302,14 @@ impl Stream for ReadDir {
301
302
let mut inner = opt. take ( ) . unwrap ( ) ;
302
303
303
304
// Start the operation asynchronously.
304
- self . 0 = State :: Busy ( Box :: pin ( unblock ( move || {
305
+ self . 0 = State :: Busy ( unblock ( move || {
305
306
let next = inner. next ( ) ;
306
307
( inner, next)
307
- } ) ) ) ;
308
+ } ) ) ;
308
309
}
309
310
// Poll the asynchronous operation the file is currently blocked on.
310
311
State :: Busy ( task) => {
311
- let ( inner, opt) = ready ! ( task. as_mut ( ) . poll( cx) ) ;
312
+ let ( inner, opt) = ready ! ( task. poll( cx) ) ;
312
313
self . 0 = State :: Idle ( Some ( inner) ) ;
313
314
return Poll :: Ready ( opt. map ( |res| res. map ( |inner| DirEntry ( Arc :: new ( inner) ) ) ) ) ;
314
315
}
0 commit comments