Trait nu_protocol::RegisteredPlugin
source · pub trait RegisteredPlugin: Send + Sync {
// Required methods
fn identity(&self) -> &PluginIdentity;
fn is_running(&self) -> bool;
fn pid(&self) -> Option<u32>;
fn metadata(&self) -> Option<PluginMetadata>;
fn set_metadata(&self, metadata: Option<PluginMetadata>);
fn set_gc_config(&self, gc_config: &PluginGcConfig);
fn stop(&self) -> Result<(), ShellError>;
fn reset(&self) -> Result<(), ShellError>;
fn as_any(self: Arc<Self>) -> Arc<dyn Any + Send + Sync>;
// Provided method
fn configure_signal_handler(
self: Arc<Self>,
_handler: &Handlers,
) -> Result<(), ShellError> { ... }
}
Expand description
Trait for plugins registered in the EngineState
.
Required Methods§
sourcefn identity(&self) -> &PluginIdentity
fn identity(&self) -> &PluginIdentity
The identity of the plugin - its filename, shell, and friendly name.
sourcefn is_running(&self) -> bool
fn is_running(&self) -> bool
True if the plugin is currently running.
sourcefn metadata(&self) -> Option<PluginMetadata>
fn metadata(&self) -> Option<PluginMetadata>
Get metadata for the plugin, if set.
sourcefn set_metadata(&self, metadata: Option<PluginMetadata>)
fn set_metadata(&self, metadata: Option<PluginMetadata>)
Set metadata for the plugin.
sourcefn set_gc_config(&self, gc_config: &PluginGcConfig)
fn set_gc_config(&self, gc_config: &PluginGcConfig)
Set garbage collection config for the plugin.
sourcefn stop(&self) -> Result<(), ShellError>
fn stop(&self) -> Result<(), ShellError>
Stop the plugin.
sourcefn reset(&self) -> Result<(), ShellError>
fn reset(&self) -> Result<(), ShellError>
Stop the plugin and reset any state so that we don’t make any assumptions about the plugin
next time it launches. This is used on plugin add
.
Provided Methods§
sourcefn configure_signal_handler(
self: Arc<Self>,
_handler: &Handlers,
) -> Result<(), ShellError>
fn configure_signal_handler( self: Arc<Self>, _handler: &Handlers, ) -> Result<(), ShellError>
Give this plugin a chance to register for Ctrl-C signals.