/// Returns a `ReportReader` that can read and decode the report from the given stream.
/// Automatically detects the type of the report.
Returns a `ReportReader` that can read and decode the report from the given stream.
Automatically detects the type of the report.
Returns a ` ReportReader ` that can read and decode the report from the given stream . Automatically detects the type of the report .
pub fn open_report(r: impl Read + Send + 'static) -> io::Result<Box<dyn ReportReader>> {
    let mut buf_reader = BufReader::with_capacity(16 * 1024, r);
    let preview = buf_reader.fill_buf()?;
    let preview = String::from_utf8_lossy(preview);
    if preview.starts_with('{') {
        Ok(Box::new(JsonReportReader::new(buf_reader)?))
    } else if preview.starts_with('#') {
        Ok(Box::new(TextReportReader::new(buf_reader)))
    } else {
        Err(io::Error::new(
            ErrorKind::InvalidData,
            format!(
                "Unknown report format. Supported formats are: {}, {}",
                OutputFormat::Default,
                OutputFormat::Json
            ),
        ))
    }
}
pub fn open_report ( r : impl Read + Send + ' static ) -> io :: Result < Box < dyn ReportReader > > { let mut buf_reader = BufReader :: with_capacity ( 16 * 1024 , r ) ; let preview = buf_reader . fill_buf ( ) ? ; let preview = String :: from_utf8_lossy ( preview ) ; if preview . starts_with ( '{' ) { Ok ( Box :: new ( JsonReportReader :: new ( buf_reader ) ? ) ) } else if preview . starts_with ( '#' ) { Ok ( Box :: new ( TextReportReader :: new ( buf_reader ) ) ) } else { Err ( io :: Error :: new ( ErrorKind :: InvalidData , format ! ( " " OutputFormat Default OutputFormat Json ) , ) ) } }
Returns a `ReportReader` that can read and decode the report from the given stream.
Returns a ` ReportReader ` that can read and decode the report from the given stream .
r
impl Read + Send + 'static