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§

source

fn identity(&self) -> &PluginIdentity

The identity of the plugin - its filename, shell, and friendly name.

source

fn is_running(&self) -> bool

True if the plugin is currently running.

source

fn pid(&self) -> Option<u32>

Process ID of the plugin executable, if running.

source

fn metadata(&self) -> Option<PluginMetadata>

Get metadata for the plugin, if set.

source

fn set_metadata(&self, metadata: Option<PluginMetadata>)

Set metadata for the plugin.

source

fn set_gc_config(&self, gc_config: &PluginGcConfig)

Set garbage collection config for the plugin.

source

fn stop(&self) -> Result<(), ShellError>

Stop the plugin.

source

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.

source

fn as_any(self: Arc<Self>) -> Arc<dyn Any + Send + Sync>

Cast the pointer to an Any so that its concrete type can be retrieved.

This is necessary in order to allow nu_plugin to handle the implementation details of plugins.

Provided Methods§

source

fn configure_signal_handler( self: Arc<Self>, _handler: &Handlers, ) -> Result<(), ShellError>

Give this plugin a chance to register for Ctrl-C signals.

Implementors§