Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn version(&self) -> &str;
    fn initialize<'life0, 'life1, 'async_trait>(
        &'life0 self,
        context: &'life1 PluginContext,
    ) -> Pin<Box<dyn Future<Output = Layer4Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        input: &'life1 Value,
    ) -> Pin<Box<dyn Future<Output = Layer4Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn description(&self) -> &str { ... }
    fn dependencies(&self) -> Vec<&str> { ... }
    fn shutdown<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Layer4Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

插件接口

Required Methods§

Source

fn name(&self) -> &str

插件名称

Source

fn version(&self) -> &str

插件版本

Source

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

初始化插件

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 Value, ) -> Pin<Box<dyn Future<Output = Layer4Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

执行插件

Provided Methods§

Source

fn description(&self) -> &str

插件描述

Source

fn dependencies(&self) -> Vec<&str>

依赖列表

Source

fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Layer4Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

关闭插件

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§