use anyhow::Result; use log::*; use std::io::{self, Write}; #[derive(Debug, Eq, PartialEq, Clone, Default)] pub struct MetaPluginNone {} impl MetaPluginNone { pub fn new() -> MetaPluginNone { MetaPluginNone {} } } impl MetaPlugin for MetaPluginNone { fn create(&self) -> Result> { Ok(Box::new(DummyWriter::new())) } fn finalize(&mut self) -> io::Result { Ok("none".to_string()) } fn update(&mut self, _data: &[u8]) {} } // Dummy writer that implements Write for the none meta plugin struct DummyWriter; impl DummyWriter { fn new() -> Self { DummyWriter } } impl Write for DummyWriter { fn write(&mut self, _buf: &[u8]) -> io::Result { Ok(0) } fn flush(&mut self) -> io::Result<()> { Ok(()) } }