mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-11-04 09:01:56 +00:00 
			
		
		
		
	use explicit dyn with Write to appease compiler
This commit is contained in:
		@@ -76,7 +76,7 @@ impl<'b> Controller<'b> {
 | 
				
			|||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        reader: InputFileReader,
 | 
					        reader: InputFileReader,
 | 
				
			||||||
        printer: &mut P,
 | 
					        printer: &mut P,
 | 
				
			||||||
        writer: &mut Write,
 | 
					        writer: &mut dyn Write,
 | 
				
			||||||
        input_file: InputFile<'a>,
 | 
					        input_file: InputFile<'a>,
 | 
				
			||||||
    ) -> Result<()> {
 | 
					    ) -> Result<()> {
 | 
				
			||||||
        printer.print_header(writer, input_file)?;
 | 
					        printer.print_header(writer, input_file)?;
 | 
				
			||||||
@@ -91,7 +91,7 @@ impl<'b> Controller<'b> {
 | 
				
			|||||||
    fn print_file_ranges<P: Printer>(
 | 
					    fn print_file_ranges<P: Printer>(
 | 
				
			||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        printer: &mut P,
 | 
					        printer: &mut P,
 | 
				
			||||||
        writer: &mut Write,
 | 
					        writer: &mut dyn Write,
 | 
				
			||||||
        mut reader: InputFileReader,
 | 
					        mut reader: InputFileReader,
 | 
				
			||||||
        line_ranges: &LineRanges,
 | 
					        line_ranges: &LineRanges,
 | 
				
			||||||
    ) -> Result<()> {
 | 
					    ) -> Result<()> {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -98,7 +98,7 @@ impl OutputType {
 | 
				
			|||||||
        OutputType::Stdout(io::stdout())
 | 
					        OutputType::Stdout(io::stdout())
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pub fn handle(&mut self) -> Result<&mut Write> {
 | 
					    pub fn handle(&mut self) -> Result<&mut dyn Write> {
 | 
				
			||||||
        Ok(match *self {
 | 
					        Ok(match *self {
 | 
				
			||||||
            OutputType::Pager(ref mut command) => command
 | 
					            OutputType::Pager(ref mut command) => command
 | 
				
			||||||
                .stdin
 | 
					                .stdin
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,12 +30,12 @@ use crate::style::OutputWrap;
 | 
				
			|||||||
use crate::terminal::{as_terminal_escaped, to_ansi_color};
 | 
					use crate::terminal::{as_terminal_escaped, to_ansi_color};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub trait Printer {
 | 
					pub trait Printer {
 | 
				
			||||||
    fn print_header(&mut self, handle: &mut Write, file: InputFile) -> Result<()>;
 | 
					    fn print_header(&mut self, handle: &mut dyn Write, file: InputFile) -> Result<()>;
 | 
				
			||||||
    fn print_footer(&mut self, handle: &mut Write) -> Result<()>;
 | 
					    fn print_footer(&mut self, handle: &mut dyn Write) -> Result<()>;
 | 
				
			||||||
    fn print_line(
 | 
					    fn print_line(
 | 
				
			||||||
        &mut self,
 | 
					        &mut self,
 | 
				
			||||||
        out_of_range: bool,
 | 
					        out_of_range: bool,
 | 
				
			||||||
        handle: &mut Write,
 | 
					        handle: &mut dyn Write,
 | 
				
			||||||
        line_number: usize,
 | 
					        line_number: usize,
 | 
				
			||||||
        line_buffer: &[u8],
 | 
					        line_buffer: &[u8],
 | 
				
			||||||
    ) -> Result<()>;
 | 
					    ) -> Result<()>;
 | 
				
			||||||
@@ -50,18 +50,18 @@ impl SimplePrinter {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl Printer for SimplePrinter {
 | 
					impl Printer for SimplePrinter {
 | 
				
			||||||
    fn print_header(&mut self, _handle: &mut Write, _file: InputFile) -> Result<()> {
 | 
					    fn print_header(&mut self, _handle: &mut dyn Write, _file: InputFile) -> Result<()> {
 | 
				
			||||||
        Ok(())
 | 
					        Ok(())
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn print_footer(&mut self, _handle: &mut Write) -> Result<()> {
 | 
					    fn print_footer(&mut self, _handle: &mut dyn Write) -> Result<()> {
 | 
				
			||||||
        Ok(())
 | 
					        Ok(())
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn print_line(
 | 
					    fn print_line(
 | 
				
			||||||
        &mut self,
 | 
					        &mut self,
 | 
				
			||||||
        out_of_range: bool,
 | 
					        out_of_range: bool,
 | 
				
			||||||
        handle: &mut Write,
 | 
					        handle: &mut dyn Write,
 | 
				
			||||||
        _line_number: usize,
 | 
					        _line_number: usize,
 | 
				
			||||||
        line_buffer: &[u8],
 | 
					        line_buffer: &[u8],
 | 
				
			||||||
    ) -> Result<()> {
 | 
					    ) -> Result<()> {
 | 
				
			||||||
@@ -166,7 +166,7 @@ impl<'a> InteractivePrinter<'a> {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn print_horizontal_line(&mut self, handle: &mut Write, grid_char: char) -> Result<()> {
 | 
					    fn print_horizontal_line(&mut self, handle: &mut dyn Write, grid_char: char) -> Result<()> {
 | 
				
			||||||
        if self.panel_width == 0 {
 | 
					        if self.panel_width == 0 {
 | 
				
			||||||
            writeln!(
 | 
					            writeln!(
 | 
				
			||||||
                handle,
 | 
					                handle,
 | 
				
			||||||
@@ -192,7 +192,7 @@ impl<'a> InteractivePrinter<'a> {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl<'a> Printer for InteractivePrinter<'a> {
 | 
					impl<'a> Printer for InteractivePrinter<'a> {
 | 
				
			||||||
    fn print_header(&mut self, handle: &mut Write, file: InputFile) -> Result<()> {
 | 
					    fn print_header(&mut self, handle: &mut dyn Write, file: InputFile) -> Result<()> {
 | 
				
			||||||
        if !self.config.output_components.header() {
 | 
					        if !self.config.output_components.header() {
 | 
				
			||||||
            if Some(ContentType::BINARY) == self.content_type {
 | 
					            if Some(ContentType::BINARY) == self.content_type {
 | 
				
			||||||
                let input = match file {
 | 
					                let input = match file {
 | 
				
			||||||
@@ -262,7 +262,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
 | 
				
			|||||||
        Ok(())
 | 
					        Ok(())
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn print_footer(&mut self, handle: &mut Write) -> Result<()> {
 | 
					    fn print_footer(&mut self, handle: &mut dyn Write) -> Result<()> {
 | 
				
			||||||
        if self.config.output_components.grid() && self.content_type.map_or(false, |c| c.is_text())
 | 
					        if self.config.output_components.grid() && self.content_type.map_or(false, |c| c.is_text())
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            self.print_horizontal_line(handle, '┴')
 | 
					            self.print_horizontal_line(handle, '┴')
 | 
				
			||||||
@@ -274,7 +274,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
 | 
				
			|||||||
    fn print_line(
 | 
					    fn print_line(
 | 
				
			||||||
        &mut self,
 | 
					        &mut self,
 | 
				
			||||||
        out_of_range: bool,
 | 
					        out_of_range: bool,
 | 
				
			||||||
        handle: &mut Write,
 | 
					        handle: &mut dyn Write,
 | 
				
			||||||
        line_number: usize,
 | 
					        line_number: usize,
 | 
				
			||||||
        line_buffer: &[u8],
 | 
					        line_buffer: &[u8],
 | 
				
			||||||
    ) -> Result<()> {
 | 
					    ) -> Result<()> {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user