Skip to main content

PluginRegistry

Struct PluginRegistry 

Source
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

Source

pub fn new() -> Self

Create a new empty plugin registry.

Source

pub fn init(&mut self, context: PluginContext)

Initialize the registry with the plugin context.

Source

pub fn context(&self) -> Option<&PluginContext>

Get a reference to the plugin context.

Source

pub fn set_plugin_enabled(&mut self, name: &str, enabled: bool)

Set the enabled state for a plugin by name.

Source

pub fn is_plugin_enabled(&self, name: &str) -> bool

Check if a plugin is enabled.

Source

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.

Source

pub fn init_plugin(&mut self, id: PluginId) -> PluginResult<()>

Initialize a registered plugin.

Source

pub fn activate_plugin(&mut self, id: PluginId) -> PluginResult<()>

Activate a plugin (must be initialized first).

Source

pub fn deactivate_plugin(&mut self, id: PluginId) -> PluginResult<()>

Deactivate a plugin.

Source

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.

Source

pub fn unregister_plugin_by_name(&mut self, name: &str) -> PluginResult<()>

Unregister a plugin by name.

Source

pub fn get(&self, id: PluginId) -> Option<&dyn Plugin>

Get a plugin by ID.

Source

pub fn get_mut(&mut self, id: PluginId) -> Option<&mut dyn Plugin>

Get a mutable plugin by ID.

Source

pub fn get_by_name(&self, name: &str) -> Option<&dyn Plugin>

Get a plugin by name.

Source

pub fn info(&self, id: PluginId) -> Option<&PluginInfo>

Get plugin info by ID.

Source

pub fn info_by_name(&self, name: &str) -> Option<&PluginInfo>

Get plugin info by name.

Source

pub fn list_plugins(&self) -> Vec<&PluginInfo>

List all registered plugins.

Source

pub fn active_plugins(&self) -> Vec<&PluginInfo>

List active plugins.

Source

pub fn all_commands(&self) -> Vec<(&PluginInfo, &CommandConfig)>

Get all commands from active plugins.

Source

pub fn all_pane_types(&self) -> Vec<(&PluginInfo, &PaneConfig)>

Get all pane types from active plugins.

Source

pub fn all_keybindings(&self) -> Vec<(&PluginInfo, &KeybindingConfig)>

Get all keybindings from active plugins.

Source

pub fn all_themes(&self) -> Vec<ThemeDefinition>

Get all custom themes from active plugins.

Source

pub fn all_custom_table_panes(&self) -> Vec<CustomTableConfig>

Get all custom table pane configurations from active plugins.

Source

pub fn all_custom_chart_panes(&self) -> Vec<CustomChartConfig>

Get all custom chart pane configurations from active plugins.

Source

pub fn all_custom_stat_panes(&self) -> Vec<StatPaneConfig>

Get all custom stat pane configurations from active plugins.

Source

pub fn all_custom_gauge_panes(&self) -> Vec<GaugePaneConfig>

Get all custom gauge pane configurations from active plugins.

Source

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.

Source

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.

Source

pub fn commands_for_plugin(&self, id: PluginId) -> Vec<&CommandConfig>

Get commands for a specific plugin.

Source

pub fn keybindings_for_plugin(&self, id: PluginId) -> Vec<&KeybindingConfig>

Get keybindings for a specific plugin.

Source

pub fn execute_command(&mut self, command: &str, args: &str) -> bool

Execute a plugin command.

Source

pub fn on_workspace_loaded(&mut self)

Dispatch lifecycle: workspace loaded.

Source

pub fn on_workspace_saving(&mut self)

Dispatch lifecycle: workspace saving.

Source

pub fn on_pane_added(&mut self, pane_id: usize)

Dispatch lifecycle: pane added.

Source

pub fn on_pane_removing(&mut self, pane_id: usize)

Dispatch lifecycle: pane removing.

Source

pub fn on_pane_focused(&mut self, pane_id: usize)

Dispatch lifecycle: pane focused.

Source

pub fn on_closing(&mut self)

Dispatch lifecycle: closing.

Source

pub fn on_frame(&mut self)

Dispatch lifecycle: frame update.

Source

pub fn before_command(&mut self, command: &str, args: &str) -> CommandHookResult

Dispatch command hook: before command.

Source

pub fn after_command(&mut self, command: &str, args: &str, success: bool)

Dispatch command hook: after command.

Source

pub fn on_key_pressed(&mut self, key: &KeyEvent) -> KeyboardHookResult

Dispatch keyboard hook: key pressed.

Source

pub fn on_key_combo(&mut self, combo: &KeyCombo) -> KeyboardHookResult

Dispatch keyboard hook: key combo.

Source

pub fn on_theme_changing(&mut self, old_theme: Theme, new_theme: Theme)

Dispatch theme hook: theme changing.

Source

pub fn on_theme_changed(&mut self, theme: Theme)

Dispatch theme hook: theme changed.

Source

pub fn on_pane_created(&mut self, pane_id: usize, pane_type: &str)

Dispatch pane hook: pane created.

Source

pub fn on_query_changed(&mut self, pane_id: usize, query: &str)

Dispatch pane hook: query changed.

Source

pub fn on_data_received(&mut self, pane_id: usize)

Dispatch pane hook: data received.

Source

pub fn on_pane_error(&mut self, pane_id: usize, error: &str)

Dispatch pane hook: pane error.

Trait Implementations§

Source§

impl Default for PluginRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> MaybeSend for T
where T: Send,