pub mod error;
pub mod writers;
use error::WriterError;
use writers::{file::FileWriter, stdout::StdoutWriter};
pub(crate) trait Writer {
async fn write(&self, content: Vec<String>) -> Result<(), WriterError>;
}
pub(crate) enum WriterImpl {
Stdout(StdoutWriter),
File(FileWriter),
}
impl WriterImpl {
pub(crate) async fn write(&self, content: Vec<String>) -> Result<(), WriterError> {
match self {
Self::Stdout(writer) => writer.write(content).await,
Self::File(writer) => writer.write(content).await,
}
}
}