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 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>;
}
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 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 register.

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.

Implementors§