Plugin

Trait Plugin 

Source
pub trait Plugin: Sync + Send {
    // Required methods
    fn start(
        &self,
        pub_socket: Socket,
        sub_socket: Socket,
    ) -> Result<(), EngineError>;
    fn get_subscriptions(&self) -> Result<Vec<Box<dyn EventType>>, EngineError>;
    fn get_id(&self) -> Uuid;
    fn get_name(&self) -> String;
}
Expand description

Public API for defining the internal plugins. Internal plugns are plugins that run within the main application process in a child thread. In particular, all internal plugins must be written in Rust.

Required Methods§

Source

fn start( &self, pub_socket: Socket, sub_socket: Socket, ) -> Result<(), EngineError>

The entry point for the plugin. The engine will start the plugin in its own thread and execute this function. the pub_socket is used by the plugin to publish new events. the sub_socket is used by the plugin to get events published by other plugins.

Source

fn get_subscriptions(&self) -> Result<Vec<Box<dyn EventType>>, EngineError>

Return the event subscriptions, as a vector of strings, that this plugin is interested in.

Source

fn get_id(&self) -> Uuid

Returns the unique id for this plugin

Source

fn get_name(&self) -> String

Returns the name for the plugin

Implementors§