@@ -108,19 +108,19 @@ fn get_int(vm: &VirtualMachine, arg: &PyObjectRef) -> PyResult<BigInt> {
108
108
objint:: to_int ( vm, arg, 10 )
109
109
}
110
110
111
- fn pack_i8 ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut Write ) -> PyResult < ( ) > {
111
+ fn pack_i8 ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut dyn Write ) -> PyResult < ( ) > {
112
112
let v = get_int ( vm, arg) ?. to_i8 ( ) . unwrap ( ) ;
113
113
data. write_i8 ( v) . unwrap ( ) ;
114
114
Ok ( ( ) )
115
115
}
116
116
117
- fn pack_u8 ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut Write ) -> PyResult < ( ) > {
117
+ fn pack_u8 ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut dyn Write ) -> PyResult < ( ) > {
118
118
let v = get_int ( vm, arg) ?. to_u8 ( ) . unwrap ( ) ;
119
119
data. write_u8 ( v) . unwrap ( ) ;
120
120
Ok ( ( ) )
121
121
}
122
122
123
- fn pack_bool ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut Write ) -> PyResult < ( ) > {
123
+ fn pack_bool ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut dyn Write ) -> PyResult < ( ) > {
124
124
if objtype:: isinstance ( & arg, & vm. ctx . bool_type ( ) ) {
125
125
let v = if objbool:: get_value ( arg) { 1 } else { 0 } ;
126
126
data. write_u8 ( v) . unwrap ( ) ;
@@ -130,7 +130,11 @@ fn pack_bool(vm: &VirtualMachine, arg: &PyObjectRef, data: &mut Write) -> PyResu
130
130
}
131
131
}
132
132
133
- fn pack_i16 < Endianness > ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut Write ) -> PyResult < ( ) >
133
+ fn pack_i16 < Endianness > (
134
+ vm : & VirtualMachine ,
135
+ arg : & PyObjectRef ,
136
+ data : & mut dyn Write ,
137
+ ) -> PyResult < ( ) >
134
138
where
135
139
Endianness : byteorder:: ByteOrder ,
136
140
{
@@ -139,7 +143,11 @@ where
139
143
Ok ( ( ) )
140
144
}
141
145
142
- fn pack_u16 < Endianness > ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut Write ) -> PyResult < ( ) >
146
+ fn pack_u16 < Endianness > (
147
+ vm : & VirtualMachine ,
148
+ arg : & PyObjectRef ,
149
+ data : & mut dyn Write ,
150
+ ) -> PyResult < ( ) >
143
151
where
144
152
Endianness : byteorder:: ByteOrder ,
145
153
{
@@ -148,7 +156,11 @@ where
148
156
Ok ( ( ) )
149
157
}
150
158
151
- fn pack_i32 < Endianness > ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut Write ) -> PyResult < ( ) >
159
+ fn pack_i32 < Endianness > (
160
+ vm : & VirtualMachine ,
161
+ arg : & PyObjectRef ,
162
+ data : & mut dyn Write ,
163
+ ) -> PyResult < ( ) >
152
164
where
153
165
Endianness : byteorder:: ByteOrder ,
154
166
{
@@ -157,7 +169,11 @@ where
157
169
Ok ( ( ) )
158
170
}
159
171
160
- fn pack_u32 < Endianness > ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut Write ) -> PyResult < ( ) >
172
+ fn pack_u32 < Endianness > (
173
+ vm : & VirtualMachine ,
174
+ arg : & PyObjectRef ,
175
+ data : & mut dyn Write ,
176
+ ) -> PyResult < ( ) >
161
177
where
162
178
Endianness : byteorder:: ByteOrder ,
163
179
{
@@ -166,7 +182,11 @@ where
166
182
Ok ( ( ) )
167
183
}
168
184
169
- fn pack_i64 < Endianness > ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut Write ) -> PyResult < ( ) >
185
+ fn pack_i64 < Endianness > (
186
+ vm : & VirtualMachine ,
187
+ arg : & PyObjectRef ,
188
+ data : & mut dyn Write ,
189
+ ) -> PyResult < ( ) >
170
190
where
171
191
Endianness : byteorder:: ByteOrder ,
172
192
{
@@ -175,7 +195,11 @@ where
175
195
Ok ( ( ) )
176
196
}
177
197
178
- fn pack_u64 < Endianness > ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut Write ) -> PyResult < ( ) >
198
+ fn pack_u64 < Endianness > (
199
+ vm : & VirtualMachine ,
200
+ arg : & PyObjectRef ,
201
+ data : & mut dyn Write ,
202
+ ) -> PyResult < ( ) >
179
203
where
180
204
Endianness : byteorder:: ByteOrder ,
181
205
{
@@ -184,7 +208,11 @@ where
184
208
Ok ( ( ) )
185
209
}
186
210
187
- fn pack_f32 < Endianness > ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut Write ) -> PyResult < ( ) >
211
+ fn pack_f32 < Endianness > (
212
+ vm : & VirtualMachine ,
213
+ arg : & PyObjectRef ,
214
+ data : & mut dyn Write ,
215
+ ) -> PyResult < ( ) >
188
216
where
189
217
Endianness : byteorder:: ByteOrder ,
190
218
{
@@ -193,7 +221,11 @@ where
193
221
Ok ( ( ) )
194
222
}
195
223
196
- fn pack_f64 < Endianness > ( vm : & VirtualMachine , arg : & PyObjectRef , data : & mut Write ) -> PyResult < ( ) >
224
+ fn pack_f64 < Endianness > (
225
+ vm : & VirtualMachine ,
226
+ arg : & PyObjectRef ,
227
+ data : & mut dyn Write ,
228
+ ) -> PyResult < ( ) >
197
229
where
198
230
Endianness : byteorder:: ByteOrder ,
199
231
{
@@ -214,7 +246,7 @@ fn pack_item<Endianness>(
214
246
vm : & VirtualMachine ,
215
247
code : & FormatCode ,
216
248
arg : & PyObjectRef ,
217
- data : & mut Write ,
249
+ data : & mut dyn Write ,
218
250
) -> PyResult < ( ) >
219
251
where
220
252
Endianness : byteorder:: ByteOrder ,
@@ -287,28 +319,28 @@ fn struct_pack(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
287
319
}
288
320
}
289
321
290
- fn unpack_i8 ( vm : & VirtualMachine , rdr : & mut Read ) -> PyResult {
322
+ fn unpack_i8 ( vm : & VirtualMachine , rdr : & mut dyn Read ) -> PyResult {
291
323
match rdr. read_i8 ( ) {
292
324
Err ( err) => panic ! ( "Error in reading {:?}" , err) ,
293
325
Ok ( v) => Ok ( vm. ctx . new_int ( v) ) ,
294
326
}
295
327
}
296
328
297
- fn unpack_u8 ( vm : & VirtualMachine , rdr : & mut Read ) -> PyResult {
329
+ fn unpack_u8 ( vm : & VirtualMachine , rdr : & mut dyn Read ) -> PyResult {
298
330
match rdr. read_u8 ( ) {
299
331
Err ( err) => panic ! ( "Error in reading {:?}" , err) ,
300
332
Ok ( v) => Ok ( vm. ctx . new_int ( v) ) ,
301
333
}
302
334
}
303
335
304
- fn unpack_bool ( vm : & VirtualMachine , rdr : & mut Read ) -> PyResult {
336
+ fn unpack_bool ( vm : & VirtualMachine , rdr : & mut dyn Read ) -> PyResult {
305
337
match rdr. read_u8 ( ) {
306
338
Err ( err) => panic ! ( "Error in reading {:?}" , err) ,
307
339
Ok ( v) => Ok ( vm. ctx . new_bool ( v > 0 ) ) ,
308
340
}
309
341
}
310
342
311
- fn unpack_i16 < Endianness > ( vm : & VirtualMachine , rdr : & mut Read ) -> PyResult
343
+ fn unpack_i16 < Endianness > ( vm : & VirtualMachine , rdr : & mut dyn Read ) -> PyResult
312
344
where
313
345
Endianness : byteorder:: ByteOrder ,
314
346
{
@@ -318,7 +350,7 @@ where
318
350
}
319
351
}
320
352
321
- fn unpack_u16 < Endianness > ( vm : & VirtualMachine , rdr : & mut Read ) -> PyResult
353
+ fn unpack_u16 < Endianness > ( vm : & VirtualMachine , rdr : & mut dyn Read ) -> PyResult
322
354
where
323
355
Endianness : byteorder:: ByteOrder ,
324
356
{
@@ -328,7 +360,7 @@ where
328
360
}
329
361
}
330
362
331
- fn unpack_i32 < Endianness > ( vm : & VirtualMachine , rdr : & mut Read ) -> PyResult
363
+ fn unpack_i32 < Endianness > ( vm : & VirtualMachine , rdr : & mut dyn Read ) -> PyResult
332
364
where
333
365
Endianness : byteorder:: ByteOrder ,
334
366
{
@@ -338,7 +370,7 @@ where
338
370
}
339
371
}
340
372
341
- fn unpack_u32 < Endianness > ( vm : & VirtualMachine , rdr : & mut Read ) -> PyResult
373
+ fn unpack_u32 < Endianness > ( vm : & VirtualMachine , rdr : & mut dyn Read ) -> PyResult
342
374
where
343
375
Endianness : byteorder:: ByteOrder ,
344
376
{
@@ -348,7 +380,7 @@ where
348
380
}
349
381
}
350
382
351
- fn unpack_i64 < Endianness > ( vm : & VirtualMachine , rdr : & mut Read ) -> PyResult
383
+ fn unpack_i64 < Endianness > ( vm : & VirtualMachine , rdr : & mut dyn Read ) -> PyResult
352
384
where
353
385
Endianness : byteorder:: ByteOrder ,
354
386
{
@@ -358,7 +390,7 @@ where
358
390
}
359
391
}
360
392
361
- fn unpack_u64 < Endianness > ( vm : & VirtualMachine , rdr : & mut Read ) -> PyResult
393
+ fn unpack_u64 < Endianness > ( vm : & VirtualMachine , rdr : & mut dyn Read ) -> PyResult
362
394
where
363
395
Endianness : byteorder:: ByteOrder ,
364
396
{
@@ -368,7 +400,7 @@ where
368
400
}
369
401
}
370
402
371
- fn unpack_f32 < Endianness > ( vm : & VirtualMachine , rdr : & mut Read ) -> PyResult
403
+ fn unpack_f32 < Endianness > ( vm : & VirtualMachine , rdr : & mut dyn Read ) -> PyResult
372
404
where
373
405
Endianness : byteorder:: ByteOrder ,
374
406
{
@@ -378,7 +410,7 @@ where
378
410
}
379
411
}
380
412
381
- fn unpack_f64 < Endianness > ( vm : & VirtualMachine , rdr : & mut Read ) -> PyResult
413
+ fn unpack_f64 < Endianness > ( vm : & VirtualMachine , rdr : & mut dyn Read ) -> PyResult
382
414
where
383
415
Endianness : byteorder:: ByteOrder ,
384
416
{
@@ -419,7 +451,7 @@ fn struct_unpack(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
419
451
Ok ( vm. ctx . new_tuple ( items) )
420
452
}
421
453
422
- fn unpack_code < Endianness > ( vm : & VirtualMachine , code : & FormatCode , rdr : & mut Read ) -> PyResult
454
+ fn unpack_code < Endianness > ( vm : & VirtualMachine , code : & FormatCode , rdr : & mut dyn Read ) -> PyResult
423
455
where
424
456
Endianness : byteorder:: ByteOrder ,
425
457
{
0 commit comments