use std::io::Error;
pub enum OutputSourceType<'a> {
File(&'a str),
}
pub trait OutputSink {
fn write_data(&self, data: &[u8]) -> Result<(), Error>;
}
impl<'a> OutputSink for OutputSourceType<'a> {
fn write_data(&self, data: &[u8]) -> Result<(), Error> {
match self {
OutputSourceType::File(path) => std::fs::write(path, data),
}
}
}
pub trait OutputWriter<T: serde::Serialize> {
type Properties;
fn write(data: T, sink: &dyn OutputSink, properties: Self::Properties) -> Result<(), Error>;
}