Trait Plugin

Source
pub trait Plugin: Send + Sync {
    // Required methods
    fn init(&self) -> Box<dyn Plugin>;
    fn name(&self) -> &str;

    // Provided method
    fn call(
        &self,
        _state: *mut ShellState,
    ) -> Result<(), Box<dyn Error + Send + Sync>> { ... }
}
Expand description

The plugin trait that defines how a plugin object acts.

Required Methods§

Source

fn init(&self) -> Box<dyn Plugin>

The initializer function. Don’t mind the &self parameter, its a technicallity for this trait to be abi-safe.

Source

fn name(&self) -> &str

Return the display name of your plugin. Due to abi restrictions, this must be a function and not an associated constant.

Provided Methods§

Source

fn call( &self, _state: *mut ShellState, ) -> Result<(), Box<dyn Error + Send + Sync>>

The “heart” of the plugin; this is called with the syntax plugin.<name>.

Implementors§