pub trait Plugin: Send {
Show 22 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 handle_mouse(&mut self, _event: &MouseEvent) -> 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> { ... }
fn is_alive(&self) -> bool { ... }
fn can_background(&self) -> bool { ... }
fn set_capabilities(&mut self, _caps: Vec<String>) { ... }
fn persistent(&self) -> bool { ... }
fn set_persistent(&mut self, _persistent: bool) { ... }
}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 handle_mouse(&mut self, _event: &MouseEvent) -> 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)>
Sourcefn commands(&self) -> Vec<PluginCmdItem>
fn commands(&self) -> Vec<PluginCmdItem>
Palette commands that this plugin registers (category, label).
Sourcefn handle_palette_command(&mut self, _index: usize)
fn handle_palette_command(&mut self, _index: usize)
Called when a palette command from this plugin is selected.
index is the position in commands().
Sourcefn on_plugin_message(&mut self, _from: &str, _action: &str, _data: &str)
fn on_plugin_message(&mut self, _from: &str, _action: &str, _data: &str)
Called when a plugin-to-plugin message arrives.
Sourcefn shutdown(&mut self)
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.
Sourcefn binary_path(&self) -> Option<&Path>
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.
Sourcefn is_alive(&self) -> bool
fn is_alive(&self) -> bool
Whether the plugin process is still running.
Returns true for in-process plugins.
IPC plugins override this to check the child process.
Sourcefn can_background(&self) -> bool
fn can_background(&self) -> bool
Whether the plugin supports running in the background when the user
presses Esc (e.g., audio players that should keep playing).
Default is false. Override to return true for background-capable plugins.
Sourcefn set_capabilities(&mut self, _caps: Vec<String>)
fn set_capabilities(&mut self, _caps: Vec<String>)
Set runtime capabilities (e.g. "background") declared in the plugin manifest.
Default is no-op; IPC plugins override this to store the value.
Sourcefn persistent(&self) -> bool
fn persistent(&self) -> bool
Whether this plugin should stay loaded when the user presses Esc.
Persistent plugins are blurred but not shut down, keeping their
palette entries and background processes alive.
Default is false. Override to return true for plugins that
must not be unloaded (e.g., the registry plugin).
Sourcefn set_persistent(&mut self, _persistent: bool)
fn set_persistent(&mut self, _persistent: bool)
Mark this plugin as persistent. Default is no-op; IPC plugins override this to store the value.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".