@@ -139,7 +139,7 @@ enum Encoder<'a> {
139139impl < ' a > Encoder < ' a > {
140140 /// Encode the value at `idx`.
141141 #[ 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 > {
143143 match self {
144144 Encoder :: Boolean ( e) => e. encode ( idx, out) ,
145145 Encoder :: Int ( e) => e. encode ( idx, out) ,
@@ -167,7 +167,7 @@ impl<'a> NullableEncoder<'a> {
167167
168168 /// Encode the value at `idx`, assuming it's not-null.
169169 #[ 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 > {
171171 self . encoder . encode ( idx, out)
172172 }
173173
@@ -222,7 +222,7 @@ pub fn make_encoder<'a>(array: &'a dyn Array) -> Result<NullableEncoder<'a>, Arr
222222struct BooleanEncoder < ' a > ( & ' a arrow_array:: BooleanArray ) ;
223223impl BooleanEncoder < ' _ > {
224224 #[ 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 > {
226226 write_bool ( out, self . 0 . value ( idx) )
227227 }
228228}
@@ -231,7 +231,7 @@ impl BooleanEncoder<'_> {
231231struct IntEncoder < ' a , P : ArrowPrimitiveType < Native = i32 > > ( & ' a PrimitiveArray < P > ) ;
232232impl < ' a , P : ArrowPrimitiveType < Native = i32 > > IntEncoder < ' a , P > {
233233 #[ 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 > {
235235 write_int ( out, self . 0 . value ( idx) )
236236 }
237237}
@@ -240,7 +240,7 @@ impl<'a, P: ArrowPrimitiveType<Native = i32>> IntEncoder<'a, P> {
240240struct LongEncoder < ' a , P : ArrowPrimitiveType < Native = i64 > > ( & ' a PrimitiveArray < P > ) ;
241241impl < ' a , P : ArrowPrimitiveType < Native = i64 > > LongEncoder < ' a , P > {
242242 #[ 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 > {
244244 write_long ( out, self . 0 . value ( idx) )
245245 }
246246}
@@ -249,15 +249,15 @@ impl<'a, P: ArrowPrimitiveType<Native = i64>> LongEncoder<'a, P> {
249249struct BinaryEncoder < ' a , O : OffsetSizeTrait > ( & ' a GenericBinaryArray < O > ) ;
250250impl < ' a , O : OffsetSizeTrait > BinaryEncoder < ' a , O > {
251251 #[ 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 > {
253253 write_len_prefixed ( out, self . 0 . value ( idx) )
254254 }
255255}
256256
257257struct F32Encoder < ' a > ( & ' a arrow_array:: Float32Array ) ;
258258impl F32Encoder < ' _ > {
259259 #[ 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 > {
261261 // Avro float: 4 bytes, IEEE-754 little-endian
262262 let bits = self . 0 . value ( idx) . to_bits ( ) ;
263263 out. write_all ( & bits. to_le_bytes ( ) )
@@ -268,7 +268,7 @@ impl F32Encoder<'_> {
268268struct F64Encoder < ' a > ( & ' a arrow_array:: Float64Array ) ;
269269impl F64Encoder < ' _ > {
270270 #[ 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 > {
272272 // Avro double: 8 bytes, IEEE-754 little-endian
273273 let bits = self . 0 . value ( idx) . to_bits ( ) ;
274274 out. write_all ( & bits. to_le_bytes ( ) )
0 commit comments