@@ -11,10 +11,10 @@ use crate::lessopen::LessOpenPreprocessor;
1111#[ cfg( feature = "git" ) ]
1212use crate :: line_range:: LineRange ;
1313use crate :: line_range:: { LineRanges , RangeCheckResult } ;
14- use crate :: output:: OutputType ;
14+ use crate :: output:: { OutputHandle , OutputType } ;
1515#[ cfg( feature = "paging" ) ]
1616use crate :: paging:: PagingMode ;
17- use crate :: printer:: { InteractivePrinter , OutputHandle , Printer , SimplePrinter } ;
17+ use crate :: printer:: { InteractivePrinter , Printer , SimplePrinter } ;
1818
1919use clircle:: { Clircle , Identifier } ;
2020
@@ -35,18 +35,14 @@ impl Controller<'_> {
3535 }
3636 }
3737
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)
4440 }
4541
4642 pub fn run_with_error_handler (
4743 & self ,
4844 inputs : Vec < Input > ,
49- output_buffer : Option < & mut dyn std :: fmt :: Write > ,
45+ output_handle : Option < OutputHandle < ' _ > > ,
5046 mut handle_error : impl FnMut ( & Error , & mut dyn Write ) ,
5147 ) -> Result < bool > {
5248 let mut output_type;
@@ -88,8 +84,9 @@ impl Controller<'_> {
8884 clircle:: Identifier :: stdout ( )
8985 } ;
9086
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) ,
9390 None => OutputHandle :: IoWrite ( output_type. handle ( ) ?) ,
9491 } ;
9592 let mut no_errors: bool = true ;
0 commit comments