Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Send {
Show 16 methods // Required methods fn id(&self) -> &str; fn name(&self) -> &str; fn init(&mut self, ctx: &mut PluginContext) -> Result<(), Box<dyn Error>>; // Provided methods fn handle_key(&mut self, _key: KeyEvent) -> bool { ... } fn render(&self, _f: &mut Frame<'_>, _area: Rect) { ... } fn tick(&mut self) { ... } fn on_focus(&mut self) { ... } fn on_blur(&mut self) { ... } fn on_theme_change(&mut self, theme: &Theme) { ... } fn on_user_update(&mut self, _user: Option<&User>) { ... } fn status_hints(&self) -> Vec<(String, String)> { ... } fn commands(&self) -> Vec<PluginCmdItem> { ... } fn handle_palette_command(&mut self, _index: usize) { ... } fn on_plugin_message(&mut self, _from: &str, _action: &str, _data: &str) { ... } fn shutdown(&mut self) { ... } fn binary_path(&self) -> Option<&Path> { ... }
}

Required Methods§

Source

fn id(&self) -> &str

Source

fn name(&self) -> &str

Source

fn init(&mut self, ctx: &mut PluginContext) -> Result<(), Box<dyn Error>>

Provided Methods§

Source

fn handle_key(&mut self, _key: KeyEvent) -> bool

Source

fn render(&self, _f: &mut Frame<'_>, _area: Rect)

Source

fn tick(&mut self)

Source

fn on_focus(&mut self)

Source

fn on_blur(&mut self)

Source

fn on_theme_change(&mut self, theme: &Theme)

Source

fn on_user_update(&mut self, _user: Option<&User>)

Source

fn status_hints(&self) -> Vec<(String, String)>

Source

fn commands(&self) -> Vec<PluginCmdItem>

Palette commands that this plugin registers (category, label).

Source

fn handle_palette_command(&mut self, _index: usize)

Called when a palette command from this plugin is selected. index is the position in commands().

Source

fn on_plugin_message(&mut self, _from: &str, _action: &str, _data: &str)

Called when a plugin-to-plugin message arrives.

Source

fn shutdown(&mut self)

Called before the plugin is unloaded (hot-reload or app exit). The plugin should flush state, close handles, and prepare to be dropped. For IPC plugins this sends Shutdown and waits briefly for a response before the child process is killed.

Source

fn binary_path(&self) -> Option<&Path>

Return the filesystem path to this plugin’s binary, if it runs as an external process. None for in-process plugins. Used by the hot-reload mechanism to detect when the binary has been updated on disk.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§