pub fn write_output(dest: &mut Option<File>, readme: String) -> Result<(), String> {
    match dest.as_mut() {
        Some(dest) => {
            let mut bytes = readme.into_bytes();
            // Append new line at end of file to match behavior of `cargo readme > README.md`
            bytes.push(b'\n');

            dest.write_all(&mut bytes)
                .map(|_| ())
                .map_err(|e| format!("Could not write to output file: {}", e))?;
        }
        None => println!("{}", readme),
    }

    Ok(())
}
/// Write result to output, either stdout or destination file
Write result to output, either stdout or destination file
Write result to output either stdout or destination file
pub fn write_output(dest: &mut Option<File>, readme: String) -> Result<(), String> {
    match dest.as_mut() {
        Some(dest) => {
            let mut bytes = readme.into_bytes();
            // Append new line at end of file to match behavior of `cargo readme > README.md`
            bytes.push(b'\n');
            dest.write_all(&mut bytes)
                .map(|_| ())
                .map_err(|e| format!("Could not write to output file: {}", e))?;
        }
        None => println!("{}", readme),
    }
    Ok(())
}
pub fn write_output ( dest : & mut Option < File > , readme : String ) -> Result < ( ) , String > { match dest . as_mut ( ) { Some ( dest ) => { let mut bytes = readme . into_bytes ( ) ; // Append new line at end of file to match behavior of `cargo readme > README.md` bytes . push ( b'\n' ) ; dest . write_all ( & mut bytes ) . map ( | _ | ( ) ) . map_err ( | e | format ! ( " " e ) ) ? ; } None => println ! ( " " readme ) , } Ok ( ( ) ) }
Write result to output, either stdout or destination file
Write result to output either stdout or destination file
dest
&mut Option<File>
readme
String