Skip to main content

ServerPlugin

Trait ServerPlugin 

Source
pub trait ServerPlugin:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn run<'life0, 'async_trait>(
        &'life0 self,
        ctx: PluginContext,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn rpc_methods(&self) -> Vec<RpcMethodDef> { ... }
}
Expand description

Trait for plugins that run a single long-lived background task. The run future should observe ctx.shutdown and return when signaled.

Required Methods§

Source

fn name(&self) -> &'static str

Stable plugin name (same semantics as Plugin::name).

Source

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

Run the plugin’s main loop. Return Ok(()) on shutdown.

Provided Methods§

Source

fn rpc_methods(&self) -> Vec<RpcMethodDef>

Optional RPC method advertisements (default empty).

Implementors§