pub trait Plugin:
Send
+ Sync
+ Debug {
// Required methods
fn name(&self) -> &'static str;
fn apply<'life0, 'async_trait>(
&'life0 self,
ctx: Arc<Context>,
) -> Pin<Box<dyn Future<Output = FrameworkResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn on_load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = FrameworkResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn on_unload<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = FrameworkResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
插件特性,定义了插件的基本行为。
插件应该能够响应会话事件,并拥有一个唯一的名称。
Required Methods§
Provided Methods§
fn on_load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = FrameworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_unload<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = FrameworkResult<()>> + 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".