Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn name(&self) -> &str;
    fn version(&self) -> &str;
    fn description(&self) -> &str;
    fn author(&self) -> &str;
    fn category(&self) -> PluginCategory;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        context: &'life1 PluginContext,
    ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn api_version(&self) -> &str { ... }
    fn validate(&self) -> Result<(), PluginError> { ... }
}
Expand description

Extension contract for source-linked native plugins.

Implementations record observations through PluginContext::record and use PluginContext::request for host-authorized network work. Successful completion grants no finding or verification authority.

Required Methods§

Source

fn id(&self) -> &str

Stable plugin identity.

Source

fn name(&self) -> &str

Human-readable plugin name.

Source

fn version(&self) -> &str

Plugin implementation version.

Source

fn description(&self) -> &str

Human-readable description.

Source

fn author(&self) -> &str

Human-readable author or owner.

Source

fn category(&self) -> PluginCategory

Informational plugin category.

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Executes one host-authorized invocation.

Provided Methods§

Source

fn api_version(&self) -> &str

Plugin API line targeted by this implementation.

Source

fn validate(&self) -> Result<(), PluginError>

Validates static plugin prerequisites before registration.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§