pub struct PluginRegistry { /* private fields */ }Expand description
Central registry for managing plugins.
The registry handles plugin lifecycle:
- Registration: Adding plugins to the system
- Initialization: Setting up plugins with context
- Activation/Deactivation: Enabling/disabling plugins
- Hook dispatch: Routing events to interested plugins
Implementations§
Source§impl PluginRegistry
impl PluginRegistry
Sourcepub fn init(&mut self, context: PluginContext)
pub fn init(&mut self, context: PluginContext)
Initialize the registry with the plugin context.
Sourcepub fn context(&self) -> Option<&PluginContext>
pub fn context(&self) -> Option<&PluginContext>
Get a reference to the plugin context.
Sourcepub fn set_plugin_enabled(&mut self, name: &str, enabled: bool)
pub fn set_plugin_enabled(&mut self, name: &str, enabled: bool)
Set the enabled state for a plugin by name.
Sourcepub fn is_plugin_enabled(&self, name: &str) -> bool
pub fn is_plugin_enabled(&self, name: &str) -> bool
Check if a plugin is enabled.
Sourcepub fn register<P: Plugin + 'static>(
&mut self,
plugin: P,
enabled_by_default: bool,
) -> PluginResult<PluginId>
pub fn register<P: Plugin + 'static>( &mut self, plugin: P, enabled_by_default: bool, ) -> PluginResult<PluginId>
Register a plugin with the registry.
This does not initialize or activate the plugin - call init_plugin
and activate_plugin separately.
Sourcepub fn init_plugin(&mut self, id: PluginId) -> PluginResult<()>
pub fn init_plugin(&mut self, id: PluginId) -> PluginResult<()>
Initialize a registered plugin.
Sourcepub fn activate_plugin(&mut self, id: PluginId) -> PluginResult<()>
pub fn activate_plugin(&mut self, id: PluginId) -> PluginResult<()>
Activate a plugin (must be initialized first).
Sourcepub fn deactivate_plugin(&mut self, id: PluginId) -> PluginResult<()>
pub fn deactivate_plugin(&mut self, id: PluginId) -> PluginResult<()>
Deactivate a plugin.
Sourcepub fn unregister_plugin(&mut self, id: PluginId) -> PluginResult<()>
pub fn unregister_plugin(&mut self, id: PluginId) -> PluginResult<()>
Unregister a plugin completely, removing it from the registry.
This deactivates the plugin first if it’s active, then removes all references to it from the registry. Use this for hot-reload scenarios where you need to replace a plugin with a new version.
Sourcepub fn unregister_plugin_by_name(&mut self, name: &str) -> PluginResult<()>
pub fn unregister_plugin_by_name(&mut self, name: &str) -> PluginResult<()>
Unregister a plugin by name.
Sourcepub fn get_by_name(&self, name: &str) -> Option<&dyn Plugin>
pub fn get_by_name(&self, name: &str) -> Option<&dyn Plugin>
Get a plugin by name.
Sourcepub fn info(&self, id: PluginId) -> Option<&PluginInfo>
pub fn info(&self, id: PluginId) -> Option<&PluginInfo>
Get plugin info by ID.
Sourcepub fn info_by_name(&self, name: &str) -> Option<&PluginInfo>
pub fn info_by_name(&self, name: &str) -> Option<&PluginInfo>
Get plugin info by name.
Sourcepub fn list_plugins(&self) -> Vec<&PluginInfo>
pub fn list_plugins(&self) -> Vec<&PluginInfo>
List all registered plugins.
Sourcepub fn active_plugins(&self) -> Vec<&PluginInfo>
pub fn active_plugins(&self) -> Vec<&PluginInfo>
List active plugins.
Sourcepub fn all_commands(&self) -> Vec<(&PluginInfo, &CommandConfig)>
pub fn all_commands(&self) -> Vec<(&PluginInfo, &CommandConfig)>
Get all commands from active plugins.
Sourcepub fn all_pane_types(&self) -> Vec<(&PluginInfo, &PaneConfig)>
pub fn all_pane_types(&self) -> Vec<(&PluginInfo, &PaneConfig)>
Get all pane types from active plugins.
Sourcepub fn all_keybindings(&self) -> Vec<(&PluginInfo, &KeybindingConfig)>
pub fn all_keybindings(&self) -> Vec<(&PluginInfo, &KeybindingConfig)>
Get all keybindings from active plugins.
Sourcepub fn all_themes(&self) -> Vec<ThemeDefinition>
pub fn all_themes(&self) -> Vec<ThemeDefinition>
Get all custom themes from active plugins.
Sourcepub fn all_custom_table_panes(&self) -> Vec<CustomTableConfig>
pub fn all_custom_table_panes(&self) -> Vec<CustomTableConfig>
Get all custom table pane configurations from active plugins.
Sourcepub fn all_custom_chart_panes(&self) -> Vec<CustomChartConfig>
pub fn all_custom_chart_panes(&self) -> Vec<CustomChartConfig>
Get all custom chart pane configurations from active plugins.
Sourcepub fn all_custom_stat_panes(&self) -> Vec<StatPaneConfig>
pub fn all_custom_stat_panes(&self) -> Vec<StatPaneConfig>
Get all custom stat pane configurations from active plugins.
Sourcepub fn all_custom_gauge_panes(&self) -> Vec<GaugePaneConfig>
pub fn all_custom_gauge_panes(&self) -> Vec<GaugePaneConfig>
Get all custom gauge pane configurations from active plugins.
Sourcepub fn all_refreshable_pane_types(&self) -> Vec<(String, u32)>
pub fn all_refreshable_pane_types(&self) -> Vec<(String, u32)>
Get all pane types that support auto-refresh from active plugins.
Returns a vector of (pane_type_name, refresh_interval_seconds) tuples.
Sourcepub fn trigger_pane_refresh(&mut self, pane_type: &str) -> bool
pub fn trigger_pane_refresh(&mut self, pane_type: &str) -> bool
Trigger a refresh for a specific pane type.
Finds the plugin that owns this pane type and calls its refresh callback. Returns true if the refresh was triggered successfully.
Sourcepub fn commands_for_plugin(&self, id: PluginId) -> Vec<&CommandConfig>
pub fn commands_for_plugin(&self, id: PluginId) -> Vec<&CommandConfig>
Get commands for a specific plugin.
Sourcepub fn keybindings_for_plugin(&self, id: PluginId) -> Vec<&KeybindingConfig>
pub fn keybindings_for_plugin(&self, id: PluginId) -> Vec<&KeybindingConfig>
Get keybindings for a specific plugin.
Sourcepub fn execute_command(&mut self, command: &str, args: &str) -> bool
pub fn execute_command(&mut self, command: &str, args: &str) -> bool
Execute a plugin command.
Sourcepub fn on_workspace_loaded(&mut self)
pub fn on_workspace_loaded(&mut self)
Dispatch lifecycle: workspace loaded.
Sourcepub fn on_workspace_saving(&mut self)
pub fn on_workspace_saving(&mut self)
Dispatch lifecycle: workspace saving.
Sourcepub fn on_pane_added(&mut self, pane_id: usize)
pub fn on_pane_added(&mut self, pane_id: usize)
Dispatch lifecycle: pane added.
Sourcepub fn on_pane_removing(&mut self, pane_id: usize)
pub fn on_pane_removing(&mut self, pane_id: usize)
Dispatch lifecycle: pane removing.
Sourcepub fn on_pane_focused(&mut self, pane_id: usize)
pub fn on_pane_focused(&mut self, pane_id: usize)
Dispatch lifecycle: pane focused.
Sourcepub fn on_closing(&mut self)
pub fn on_closing(&mut self)
Dispatch lifecycle: closing.
Sourcepub fn before_command(&mut self, command: &str, args: &str) -> CommandHookResult
pub fn before_command(&mut self, command: &str, args: &str) -> CommandHookResult
Dispatch command hook: before command.
Sourcepub fn after_command(&mut self, command: &str, args: &str, success: bool)
pub fn after_command(&mut self, command: &str, args: &str, success: bool)
Dispatch command hook: after command.
Sourcepub fn on_key_pressed(&mut self, key: &KeyEvent) -> KeyboardHookResult
pub fn on_key_pressed(&mut self, key: &KeyEvent) -> KeyboardHookResult
Dispatch keyboard hook: key pressed.
Sourcepub fn on_key_combo(&mut self, combo: &KeyCombo) -> KeyboardHookResult
pub fn on_key_combo(&mut self, combo: &KeyCombo) -> KeyboardHookResult
Dispatch keyboard hook: key combo.
Sourcepub fn on_theme_changing(&mut self, old_theme: Theme, new_theme: Theme)
pub fn on_theme_changing(&mut self, old_theme: Theme, new_theme: Theme)
Dispatch theme hook: theme changing.
Sourcepub fn on_theme_changed(&mut self, theme: Theme)
pub fn on_theme_changed(&mut self, theme: Theme)
Dispatch theme hook: theme changed.
Sourcepub fn on_pane_created(&mut self, pane_id: usize, pane_type: &str)
pub fn on_pane_created(&mut self, pane_id: usize, pane_type: &str)
Dispatch pane hook: pane created.
Sourcepub fn on_query_changed(&mut self, pane_id: usize, query: &str)
pub fn on_query_changed(&mut self, pane_id: usize, query: &str)
Dispatch pane hook: query changed.
Sourcepub fn on_data_received(&mut self, pane_id: usize)
pub fn on_data_received(&mut self, pane_id: usize)
Dispatch pane hook: data received.
Sourcepub fn on_pane_error(&mut self, pane_id: usize, error: &str)
pub fn on_pane_error(&mut self, pane_id: usize, error: &str)
Dispatch pane hook: pane error.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PluginRegistry
impl !RefUnwindSafe for PluginRegistry
impl Send for PluginRegistry
impl Sync for PluginRegistry
impl Unpin for PluginRegistry
impl UnsafeUnpin for PluginRegistry
impl !UnwindSafe for PluginRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more