updated plugin trait implementation
This commit is contained in:
parent
f2be134720
commit
cd19788959
|
|
@ -1,3 +1,4 @@
|
|||
use crate::plugin::plugin_details::PluginDetails;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// # GetPluginFn
|
||||
|
|
@ -12,8 +13,8 @@ pub type GetPluginFn = fn() -> Arc<dyn Plugin>;
|
|||
/// - init: This defines the initialisation routine for the.
|
||||
/// - run: defines a routine to be ran like a thread.
|
||||
#[async_trait::async_trait]
|
||||
pub trait Plugin {
|
||||
pub trait Plugin: Send + Sync {
|
||||
fn details(&self) -> PluginDetails;
|
||||
fn init(self: &Arc<Self>);
|
||||
async fn run(self: &Arc<Self>);
|
||||
fn init(&self);
|
||||
async fn run(&self);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
use crate::plugin::plugin_details::PluginDetails;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// # GetPluginFn
|
||||
/// This defines the type for getting the plugin struct from a
|
||||
pub type GetPluginFn = fn() -> Arc<dyn Plugin>;
|
||||
|
||||
/// # Plugin
|
||||
/// This trait defines an interface for plugins to implement.
|
||||
///
|
||||
/// ## Methods
|
||||
/// - details: This returns the details about the plugin.
|
||||
/// - init: This defines the initialisation routine for the.
|
||||
/// - run: defines a routine to be ran like a thread.
|
||||
#[async_trait::async_trait]
|
||||
pub trait Plugin: Send + Sync {
|
||||
fn details(&self) -> PluginDetails;
|
||||
fn init(&self);
|
||||
async fn run(&self);
|
||||
}
|
||||
Loading…
Reference in New Issue