plugin_interfaces/
handler.rs1use crate::callbacks::{HostCallbacks, set_host_callbacks};
2use crate::metadata::PluginMetadata;
3use crate::pluginui::{Context,Ui};
4
5pub trait PluginHandler: Send + Sync {
8 fn initialize(&self, callbacks: HostCallbacks) -> Result<(), Box<dyn std::error::Error>> {
10 set_host_callbacks(callbacks).map_err(|_| "Failed to set host callbacks")?;
12 Ok(())
13 }
14
15 fn update_ui(&mut self, ctx: &Context, ui: &mut Ui);
18
19 fn on_mount(&mut self, metadata: &PluginMetadata) -> Result<(), Box<dyn std::error::Error>>;
21
22 fn on_dispose(&mut self) -> Result<(), Box<dyn std::error::Error>>;
24
25 fn on_connect(&mut self) -> Result<(), Box<dyn std::error::Error>>;
27
28 fn on_disconnect(&mut self) -> Result<(), Box<dyn std::error::Error>>;
30
31 fn handle_message(&self, message: &str) -> Result<String, Box<dyn std::error::Error>>;
33
34 fn get_metadata(&self) -> PluginMetadata;
36}