@@ -144,10 +144,10 @@ impl File {
144
144
/// # Ok(()) }) }
145
145
/// ```
146
146
pub async fn sync_all ( & self ) -> io:: Result < ( ) > {
147
- // Drain the write cache before calling `sync_all()`.
147
+ // Flush the write cache before calling `sync_all()`.
148
148
let state = future:: poll_fn ( |cx| {
149
149
let state = futures_core:: ready!( self . lock. poll_lock( cx) ) ;
150
- state. poll_drain ( cx)
150
+ state. poll_flush ( cx)
151
151
} )
152
152
. await ?;
153
153
@@ -214,11 +214,11 @@ impl File {
214
214
/// # Ok(()) }) }
215
215
/// ```
216
216
pub async fn set_len ( & self , size : u64 ) -> io:: Result < ( ) > {
217
- // Invalidate the read/ write cache before calling `set_len()`.
217
+ // Invalidate the read cache and flush the write cache before calling `set_len()`.
218
218
let state = future:: poll_fn ( |cx| {
219
219
let state = futures_core:: ready!( self . lock. poll_lock( cx) ) ;
220
220
let state = futures_core:: ready!( state. poll_unread( cx) ) ?;
221
- state. poll_drain ( cx)
221
+ state. poll_flush ( cx)
222
222
} )
223
223
. await ?;
224
224
@@ -604,9 +604,9 @@ impl LockGuard<State> {
604
604
return Poll :: Ready ( ( & * self . file ) . seek ( pos) ) ;
605
605
}
606
606
607
- // Invalidate the read/ write cache before calling `seek()`.
607
+ // Invalidate the read cache and flush the write cache before calling `seek()`.
608
608
self = futures_core:: ready!( self . poll_unread( cx) ) ?;
609
- self = futures_core:: ready!( self . poll_drain ( cx) ) ?;
609
+ self = futures_core:: ready!( self . poll_flush ( cx) ) ?;
610
610
611
611
// Seek to the new position. This call is hopefully not blocking because it should just
612
612
// change the internal offset into the file and not touch the actual file.
@@ -641,8 +641,8 @@ impl LockGuard<State> {
641
641
}
642
642
}
643
643
Mode :: Writing => {
644
- // If we're in writing mode, drain the write cache.
645
- self = futures_core:: ready!( self . poll_drain ( cx) ) ?;
644
+ // If we're in writing mode, flush the write cache.
645
+ self = futures_core:: ready!( self . poll_flush ( cx) ) ?;
646
646
}
647
647
}
648
648
0 commit comments