@@ -160,7 +160,7 @@ pub fn get_input(config: &Config) -> UResult<Box<dyn Read>> {
160
160
}
161
161
}
162
162
163
- pub fn handle_input < R : Read > ( input : & mut R , format : Format , config : Config ) -> UResult < ( ) > {
163
+ pub fn handle_input ( input : & mut dyn Read , format : Format , config : Config ) -> UResult < ( ) > {
164
164
let supports_fast_decode_and_encode = get_supports_fast_decode_and_encode ( format) ;
165
165
166
166
let supports_fast_decode_and_encode_ref = supports_fast_decode_and_encode. as_ref ( ) ;
@@ -377,13 +377,13 @@ pub mod fast_encode {
377
377
}
378
378
379
379
fn write_to_output (
380
- line_wrapping_option : & mut Option < LineWrapping > ,
380
+ line_wrapping : & mut Option < LineWrapping > ,
381
381
encoded_buffer : & mut VecDeque < u8 > ,
382
382
output : & mut dyn Write ,
383
383
is_cleanup : bool ,
384
384
) -> io:: Result < ( ) > {
385
385
// Write all data in `encoded_buffer` to `output`
386
- if let & mut Some ( ref mut li) = line_wrapping_option {
386
+ if let & mut Some ( ref mut li) = line_wrapping {
387
387
write_with_line_breaks ( li, encoded_buffer, output, is_cleanup) ?;
388
388
} else {
389
389
write_without_line_breaks ( encoded_buffer, output, is_cleanup) ?;
@@ -393,9 +393,9 @@ pub mod fast_encode {
393
393
}
394
394
// End of helper functions
395
395
396
- pub fn fast_encode < R : Read , W : Write > (
397
- input : & mut R ,
398
- mut output : W ,
396
+ pub fn fast_encode (
397
+ input : & mut dyn Read ,
398
+ output : & mut dyn Write ,
399
399
supports_fast_decode_and_encode : & dyn SupportsFastDecodeAndEncode ,
400
400
wrap : Option < usize > ,
401
401
) -> UResult < ( ) > {
@@ -475,14 +475,14 @@ pub mod fast_encode {
475
475
assert ! ( leftover_buffer. len( ) < encode_in_chunks_of_size) ;
476
476
477
477
// Write all data in `encoded_buffer` to `output`
478
- write_to_output ( & mut line_wrapping, & mut encoded_buffer, & mut output, false ) ?;
478
+ write_to_output ( & mut line_wrapping, & mut encoded_buffer, output, false ) ?;
479
479
}
480
480
Err ( er) => {
481
481
let kind = er. kind ( ) ;
482
482
483
483
if kind == ErrorKind :: Interrupted {
484
- // TODO
485
- // Retry reading?
484
+ // Retry reading
485
+ continue ;
486
486
}
487
487
488
488
return Err ( USimpleError :: new ( 1 , format_read_error ( kind) ) ) ;
@@ -499,7 +499,7 @@ pub mod fast_encode {
499
499
500
500
// Write all data in `encoded_buffer` to output
501
501
// `is_cleanup` triggers special cleanup-only logic
502
- write_to_output ( & mut line_wrapping, & mut encoded_buffer, & mut output, true ) ?;
502
+ write_to_output ( & mut line_wrapping, & mut encoded_buffer, output, true ) ?;
503
503
}
504
504
505
505
Ok ( ( ) )
@@ -606,9 +606,9 @@ pub mod fast_decode {
606
606
}
607
607
// End of helper functions
608
608
609
- pub fn fast_decode < R : Read , W : Write > (
610
- input : & mut R ,
611
- mut output : & mut W ,
609
+ pub fn fast_decode (
610
+ input : & mut dyn Read ,
611
+ output : & mut dyn Write ,
612
612
supports_fast_decode_and_encode : & dyn SupportsFastDecodeAndEncode ,
613
613
ignore_garbage : bool ,
614
614
) -> UResult < ( ) > {
@@ -711,14 +711,14 @@ pub mod fast_decode {
711
711
assert ! ( leftover_buffer. len( ) < decode_in_chunks_of_size) ;
712
712
713
713
// Write all data in `decoded_buffer` to `output`
714
- write_to_output ( & mut decoded_buffer, & mut output) ?;
714
+ write_to_output ( & mut decoded_buffer, output) ?;
715
715
}
716
716
Err ( er) => {
717
717
let kind = er. kind ( ) ;
718
718
719
719
if kind == ErrorKind :: Interrupted {
720
- // TODO
721
- // Retry reading?
720
+ // Retry reading
721
+ continue ;
722
722
}
723
723
724
724
return Err ( USimpleError :: new ( 1 , format_read_error ( kind) ) ) ;
@@ -734,7 +734,7 @@ pub mod fast_decode {
734
734
. decode_into_vec ( & leftover_buffer, & mut decoded_buffer) ?;
735
735
736
736
// Write all data in `decoded_buffer` to `output`
737
- write_to_output ( & mut decoded_buffer, & mut output) ?;
737
+ write_to_output ( & mut decoded_buffer, output) ?;
738
738
}
739
739
740
740
Ok ( ( ) )
0 commit comments