stawege_plugin/
plugin.rs

1extern crate alloc;
2
3use alloc::rc::Rc;
4use core::{any::Any, error::Error};
5use std::{fs::File, path::PathBuf};
6
7use crate::PluginContext;
8
9pub trait Plugin: Any {
10    #[allow(unused)]
11    fn init(&mut self, context: &PluginContext) {}
12
13    fn extensions(&self) -> &[&str] {
14        &[]
15    }
16
17    #[allow(unused)]
18    fn is_valid_extension(&self, extension: &str) -> bool {
19        self.extensions().contains(&extension)
20    }
21
22    #[allow(unused)]
23    fn prepare(&mut self, context: &PluginContext) {}
24
25    #[allow(unused)]
26    fn process_file_to(
27        &mut self,
28        source_file: File,
29        output_file: File,
30    ) -> Result<(), Box<dyn Error>> {
31        Ok(())
32    }
33
34    fn reset(&mut self) {}
35
36    fn get_dependencies(&mut self) -> Option<Vec<Rc<PathBuf>>> {
37        None
38    }
39}