@@ -139,7 +139,7 @@ enum Encoder<'a> {
139
139
impl < ' a > Encoder < ' a > {
140
140
/// Encode the value at `idx`.
141
141
#[ inline]
142
- fn encode ( & mut self , idx : usize , out : & mut dyn Write ) -> Result < ( ) , ArrowError > {
142
+ fn encode < W : Write + ? Sized > ( & mut self , idx : usize , out : & mut W ) -> Result < ( ) , ArrowError > {
143
143
match self {
144
144
Encoder :: Boolean ( e) => e. encode ( idx, out) ,
145
145
Encoder :: Int ( e) => e. encode ( idx, out) ,
@@ -167,7 +167,7 @@ impl<'a> NullableEncoder<'a> {
167
167
168
168
/// Encode the value at `idx`, assuming it's not-null.
169
169
#[ inline]
170
- fn encode ( & mut self , idx : usize , out : & mut dyn Write ) -> Result < ( ) , ArrowError > {
170
+ fn encode < W : Write + ? Sized > ( & mut self , idx : usize , out : & mut W ) -> Result < ( ) , ArrowError > {
171
171
self . encoder . encode ( idx, out)
172
172
}
173
173
@@ -222,7 +222,7 @@ pub fn make_encoder<'a>(array: &'a dyn Array) -> Result<NullableEncoder<'a>, Arr
222
222
struct BooleanEncoder < ' a > ( & ' a arrow_array:: BooleanArray ) ;
223
223
impl BooleanEncoder < ' _ > {
224
224
#[ inline]
225
- fn encode ( & mut self , idx : usize , out : & mut dyn Write ) -> Result < ( ) , ArrowError > {
225
+ fn encode < W : Write + ? Sized > ( & mut self , idx : usize , out : & mut W ) -> Result < ( ) , ArrowError > {
226
226
write_bool ( out, self . 0 . value ( idx) )
227
227
}
228
228
}
@@ -231,7 +231,7 @@ impl BooleanEncoder<'_> {
231
231
struct IntEncoder < ' a , P : ArrowPrimitiveType < Native = i32 > > ( & ' a PrimitiveArray < P > ) ;
232
232
impl < ' a , P : ArrowPrimitiveType < Native = i32 > > IntEncoder < ' a , P > {
233
233
#[ inline]
234
- fn encode ( & mut self , idx : usize , out : & mut dyn Write ) -> Result < ( ) , ArrowError > {
234
+ fn encode < W : Write + ? Sized > ( & mut self , idx : usize , out : & mut W ) -> Result < ( ) , ArrowError > {
235
235
write_int ( out, self . 0 . value ( idx) )
236
236
}
237
237
}
@@ -240,7 +240,7 @@ impl<'a, P: ArrowPrimitiveType<Native = i32>> IntEncoder<'a, P> {
240
240
struct LongEncoder < ' a , P : ArrowPrimitiveType < Native = i64 > > ( & ' a PrimitiveArray < P > ) ;
241
241
impl < ' a , P : ArrowPrimitiveType < Native = i64 > > LongEncoder < ' a , P > {
242
242
#[ inline]
243
- fn encode ( & mut self , idx : usize , out : & mut dyn Write ) -> Result < ( ) , ArrowError > {
243
+ fn encode < W : Write + ? Sized > ( & mut self , idx : usize , out : & mut W ) -> Result < ( ) , ArrowError > {
244
244
write_long ( out, self . 0 . value ( idx) )
245
245
}
246
246
}
@@ -249,15 +249,15 @@ impl<'a, P: ArrowPrimitiveType<Native = i64>> LongEncoder<'a, P> {
249
249
struct BinaryEncoder < ' a , O : OffsetSizeTrait > ( & ' a GenericBinaryArray < O > ) ;
250
250
impl < ' a , O : OffsetSizeTrait > BinaryEncoder < ' a , O > {
251
251
#[ inline]
252
- fn encode ( & mut self , idx : usize , out : & mut dyn Write ) -> Result < ( ) , ArrowError > {
252
+ fn encode < W : Write + ? Sized > ( & mut self , idx : usize , out : & mut W ) -> Result < ( ) , ArrowError > {
253
253
write_len_prefixed ( out, self . 0 . value ( idx) )
254
254
}
255
255
}
256
256
257
257
struct F32Encoder < ' a > ( & ' a arrow_array:: Float32Array ) ;
258
258
impl F32Encoder < ' _ > {
259
259
#[ inline]
260
- fn encode ( & mut self , idx : usize , out : & mut dyn Write ) -> Result < ( ) , ArrowError > {
260
+ fn encode < W : Write + ? Sized > ( & mut self , idx : usize , out : & mut W ) -> Result < ( ) , ArrowError > {
261
261
// Avro float: 4 bytes, IEEE-754 little-endian
262
262
let bits = self . 0 . value ( idx) . to_bits ( ) ;
263
263
out. write_all ( & bits. to_le_bytes ( ) )
@@ -268,7 +268,7 @@ impl F32Encoder<'_> {
268
268
struct F64Encoder < ' a > ( & ' a arrow_array:: Float64Array ) ;
269
269
impl F64Encoder < ' _ > {
270
270
#[ inline]
271
- fn encode ( & mut self , idx : usize , out : & mut dyn Write ) -> Result < ( ) , ArrowError > {
271
+ fn encode < W : Write + ? Sized > ( & mut self , idx : usize , out : & mut W ) -> Result < ( ) , ArrowError > {
272
272
// Avro double: 8 bytes, IEEE-754 little-endian
273
273
let bits = self . 0 . value ( idx) . to_bits ( ) ;
274
274
out. write_all ( & bits. to_le_bytes ( ) )
0 commit comments