@@ -11,10 +11,10 @@ use crate::lessopen::LessOpenPreprocessor;
11
11
#[ cfg( feature = "git" ) ]
12
12
use crate :: line_range:: LineRange ;
13
13
use crate :: line_range:: { LineRanges , RangeCheckResult } ;
14
- use crate :: output:: OutputType ;
14
+ use crate :: output:: { OutputHandle , OutputType } ;
15
15
#[ cfg( feature = "paging" ) ]
16
16
use crate :: paging:: PagingMode ;
17
- use crate :: printer:: { InteractivePrinter , OutputHandle , Printer , SimplePrinter } ;
17
+ use crate :: printer:: { InteractivePrinter , Printer , SimplePrinter } ;
18
18
19
19
use clircle:: { Clircle , Identifier } ;
20
20
@@ -35,18 +35,14 @@ impl Controller<'_> {
35
35
}
36
36
}
37
37
38
- pub fn run (
39
- & self ,
40
- inputs : Vec < Input > ,
41
- output_buffer : Option < & mut dyn std:: fmt:: Write > ,
42
- ) -> Result < bool > {
43
- self . run_with_error_handler ( inputs, output_buffer, default_error_handler)
38
+ pub fn run ( & self , inputs : Vec < Input > , output_handle : Option < OutputHandle < ' _ > > ) -> Result < bool > {
39
+ self . run_with_error_handler ( inputs, output_handle, default_error_handler)
44
40
}
45
41
46
42
pub fn run_with_error_handler (
47
43
& self ,
48
44
inputs : Vec < Input > ,
49
- output_buffer : Option < & mut dyn std :: fmt :: Write > ,
45
+ output_handle : Option < OutputHandle < ' _ > > ,
50
46
mut handle_error : impl FnMut ( & Error , & mut dyn Write ) ,
51
47
) -> Result < bool > {
52
48
let mut output_type;
@@ -88,8 +84,9 @@ impl Controller<'_> {
88
84
clircle:: Identifier :: stdout ( )
89
85
} ;
90
86
91
- let mut writer = match output_buffer {
92
- Some ( buf) => OutputHandle :: FmtWrite ( buf) ,
87
+ let mut writer = match output_handle {
88
+ Some ( OutputHandle :: FmtWrite ( w) ) => OutputHandle :: FmtWrite ( w) ,
89
+ Some ( OutputHandle :: IoWrite ( w) ) => OutputHandle :: IoWrite ( w) ,
93
90
None => OutputHandle :: IoWrite ( output_type. handle ( ) ?) ,
94
91
} ;
95
92
let mut no_errors: bool = true ;
0 commit comments