Function kripher::utils::write_to
[−]
[src]
pub fn write_to<P>(file: Option<P>, content: String) -> WriteResult where
P: AsRef<Path>,
Writes content
to a file or to stdout.
If file
is Some
, then use it as a filename to write to. Otherwise, write
to the standard output.
If any error is found, return an Err
.
Examples
use kripher::utils::write_to; // Write 'Content' to a file. match write_to(Some("/tmp/output"), String::from("Content")) { Ok(_) => println!("write successfull"), Err(_) => println!("Oops!"), }