@@ -236,16 +236,20 @@ fn add_pflash_args(cmd: &mut Command, file: &Path, mode: PflashMode) {
236
236
cmd. arg ( arg) ;
237
237
}
238
238
239
- pub struct Io < R : Read , W : Write > {
240
- reader : BufReader < R > ,
241
- writer : W ,
239
+ pub struct Io {
240
+ reader : BufReader < Box < dyn Read + Send > > ,
241
+ writer : Box < dyn Write + Send > ,
242
242
}
243
243
244
- impl < R : Read , W : Write > Io < R , W > {
245
- pub fn new ( r : R , w : W ) -> Self {
244
+ impl Io {
245
+ pub fn new < R , W > ( r : R , w : W ) -> Self
246
+ where
247
+ R : Read + Send + ' static ,
248
+ W : Write + Send + ' static ,
249
+ {
246
250
Self {
247
- reader : BufReader :: new ( r ) ,
248
- writer : w ,
251
+ reader : BufReader :: new ( Box :: new ( r ) ) ,
252
+ writer : Box :: new ( w ) ,
249
253
}
250
254
}
251
255
@@ -277,7 +281,7 @@ impl<R: Read, W: Write> Io<R, W> {
277
281
}
278
282
}
279
283
280
- fn echo_filtered_stdout < R : Read , W : Write > ( mut child_io : Io < R , W > ) {
284
+ fn echo_filtered_stdout ( mut child_io : Io ) {
281
285
// This regex is used to detect and strip ANSI escape codes. These
282
286
// escapes are added by the console output protocol when writing to
283
287
// the serial device.
@@ -293,11 +297,7 @@ fn echo_filtered_stdout<R: Read, W: Write>(mut child_io: Io<R, W>) {
293
297
}
294
298
}
295
299
296
- fn process_qemu_io < R : Read , W : Write > (
297
- mut monitor_io : Io < R , W > ,
298
- mut serial_io : Io < R , W > ,
299
- tmp_dir : & Path ,
300
- ) -> Result < ( ) > {
300
+ fn process_qemu_io ( mut monitor_io : Io , mut serial_io : Io , tmp_dir : & Path ) -> Result < ( ) > {
301
301
// Execute the QEMU monitor handshake, doing basic sanity checks.
302
302
assert ! ( monitor_io. read_line( ) ?. starts_with( r#"{"QMP":"# ) ) ;
303
303
monitor_io. write_json ( json ! ( { "execute" : "qmp_capabilities" } ) ) ?;
0 commit comments