Function oneio::get_writer
source · pub fn get_writer(path: &str) -> Result<Box<dyn Write>, OneIoError>
Expand description
Returns a writer for the given file path with the corresponding compression.
§Arguments
path
- A string slice representing the file path.
§Returns
Result<Box<dyn Write>, OneIoError>
- A result containing a boxed writer trait object or an error.
§Examples
use std::io::{self, Write};
use oneio::get_writer;
let writer = match get_writer("output.txt") {
Ok(writer) => writer,
Err(error) => panic!("Failed to create writer: {:?}", error),
};