fn write_stats(stats: &ResponseStats, cfg: &Config) -> Result<()> {
    let formatted = fmt(stats, &cfg.format)?;

    if let Some(output) = &cfg.output {
        fs::write(output, formatted).context("Cannot write status output to file")?;
    } else {
        if cfg.verbose && !stats.is_empty() {
            // separate summary from the verbose list of links above
            println!();
        }
        // we assume that the formatted stats don't have a final newline
        println!("{}", stats);
    }
    Ok(())
}
/// Write final statistics to stdout or to file
Write final statistics to stdout or to file
Write final statistics to stdout or to file
fn write_stats(stats: &ResponseStats, cfg: &Config) -> Result<()> {
    let formatted = fmt(stats, &cfg.format)?;
    if let Some(output) = &cfg.output {
        fs::write(output, formatted).context("Cannot write status output to file")?;
    } else {
        if cfg.verbose && !stats.is_empty() {
            // separate summary from the verbose list of links above
            println!();
        }
        // we assume that the formatted stats don't have a final newline
        println!("{}", stats);
    }
    Ok(())
}
fn write_stats ( stats : & ResponseStats , cfg : & Config ) -> Result < ( ) > { let formatted = fmt ( stats , & cfg . format ) ? ; if let Some ( output ) = & cfg . output { fs :: write ( output , formatted ) . context ( " " ) ? ; } else { if cfg . verbose && ! stats . is_empty ( ) { // separate summary from the verbose list of links above println ! ( ) ; } // we assume that the formatted stats don't have a final newline println ! ( " " stats ) ; } Ok ( ( ) ) }
Write final statistics to stdout or to file
Write final statistics to stdout or to file
stats
&ResponseStats
cfg
&Config