pub trait HostHooks:
Send
+ Sync
+ 'static {
// Required methods
fn event(&self, module: &str, event: PluginEvent) -> bool;
fn log(&self, module: &str, level: LogLevel, message: &str);
fn wake(&self);
}Expand description
What the engine provides to the plugins it loads.
Every method is called from whichever thread the plugin used, at any time from the moment the module initializes until the process ends, so an implementation is a queue push rather than a piece of work.
Required Methods§
Sourcefn event(&self, module: &str, event: PluginEvent) -> bool
fn event(&self, module: &str, event: PluginEvent) -> bool
Take an event a module pushed. Returns false when the engine is no longer accepting events, which is what a plugin’s worker thread sees while the app shuts down.