pub trait Plugin: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn version(&self) -> &str;
fn methods(&self) -> Vec<MethodSpec>;
fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn on_register<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 mut PluginContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Plugin trait — implement this to extend aclaw with JSON-RPC methods
Required Methods§
Sourcefn methods(&self) -> Vec<MethodSpec>
fn methods(&self) -> Vec<MethodSpec>
List available methods this plugin provides
Provided Methods§
Sourcefn on_register<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 mut PluginContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_register<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 mut PluginContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called after registration — gives the plugin a chance to register tools and hooks. Default implementation does nothing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".