@@ -70,53 +70,53 @@ use crate::{
70
70
use arrow_array:: RecordBatch ;
71
71
use arrow_schema:: SchemaRef ;
72
72
use bytes:: Bytes ;
73
- use futures:: future:: BoxFuture ;
73
+ use futures:: future:: LocalBoxFuture ;
74
74
use futures:: FutureExt ;
75
75
use std:: mem;
76
76
use tokio:: io:: { AsyncWrite , AsyncWriteExt } ;
77
77
78
78
/// The asynchronous interface used by [`AsyncArrowWriter`] to write parquet files.
79
- pub trait AsyncFileWriter : Send {
79
+ pub trait AsyncFileWriter {
80
80
/// Write the provided bytes to the underlying writer
81
81
///
82
82
/// The underlying writer CAN decide to buffer the data or write it immediately.
83
83
/// This design allows the writer implementer to control the buffering and I/O scheduling.
84
84
///
85
85
/// The underlying writer MAY implement retry logic to prevent breaking users write process.
86
- fn write ( & mut self , bs : Bytes ) -> BoxFuture < ' _ , Result < ( ) > > ;
86
+ fn write ( & mut self , bs : Bytes ) -> LocalBoxFuture < ' _ , Result < ( ) > > ;
87
87
88
88
/// Flush any buffered data to the underlying writer and finish writing process.
89
89
///
90
90
/// After `complete` returns `Ok(())`, caller SHOULD not call write again.
91
- fn complete ( & mut self ) -> BoxFuture < ' _ , Result < ( ) > > ;
91
+ fn complete ( & mut self ) -> LocalBoxFuture < ' _ , Result < ( ) > > ;
92
92
}
93
93
94
94
impl AsyncFileWriter for Box < dyn AsyncFileWriter + ' _ > {
95
- fn write ( & mut self , bs : Bytes ) -> BoxFuture < ' _ , Result < ( ) > > {
95
+ fn write ( & mut self , bs : Bytes ) -> LocalBoxFuture < ' _ , Result < ( ) > > {
96
96
self . as_mut ( ) . write ( bs)
97
97
}
98
98
99
- fn complete ( & mut self ) -> BoxFuture < ' _ , Result < ( ) > > {
99
+ fn complete ( & mut self ) -> LocalBoxFuture < ' _ , Result < ( ) > > {
100
100
self . as_mut ( ) . complete ( )
101
101
}
102
102
}
103
103
104
- impl < T : AsyncWrite + Unpin + Send > AsyncFileWriter for T {
105
- fn write ( & mut self , bs : Bytes ) -> BoxFuture < ' _ , Result < ( ) > > {
104
+ impl < T : AsyncWrite + Unpin > AsyncFileWriter for T {
105
+ fn write ( & mut self , bs : Bytes ) -> LocalBoxFuture < ' _ , Result < ( ) > > {
106
106
async move {
107
107
self . write_all ( & bs) . await ?;
108
108
Ok ( ( ) )
109
109
}
110
- . boxed ( )
110
+ . boxed_local ( )
111
111
}
112
112
113
- fn complete ( & mut self ) -> BoxFuture < ' _ , Result < ( ) > > {
113
+ fn complete ( & mut self ) -> LocalBoxFuture < ' _ , Result < ( ) > > {
114
114
async move {
115
115
self . flush ( ) . await ?;
116
116
self . shutdown ( ) . await ?;
117
117
Ok ( ( ) )
118
118
}
119
- . boxed ( )
119
+ . boxed_local ( )
120
120
}
121
121
}
122
122
0 commit comments