Files
keep/src/meta_plugin/none.rs
2025-05-22 09:38:43 -03:00

44 lines
833 B
Rust

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<Box<dyn Write>> {
Ok(Box::new(DummyWriter::new()))
}
fn finalize(&mut self) -> io::Result<String> {
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<usize> {
Ok(0)
}
fn flush(&mut self) -> io::Result<()> {
Ok(())
}
}