pub struct Extender { /* private fields */ }Implementations§
Source§impl Extender
impl Extender
Sourcepub fn register_module<T: ActModule + Clone + 'static>(&self, module: &T)
pub fn register_module<T: ActModule + Clone + 'static>(&self, module: &T)
register module
§Example
use acts::Engine;
mod test_module {
use acts::{ActModule, Result};
#[derive(Clone)]
pub struct TestModule;
impl ActModule for TestModule {
fn init<'a>(&self, _ctx: &rquickjs::Ctx<'a>) -> Result<()> {
Ok(())
}
}
}
let engine = Engine::new();
let module = test_module::TestModule;
engine.extender().register_module(&module);Sourcepub fn register_plugin<T: ActPlugin + 'static + Clone>(&self, plugin: &T)
pub fn register_plugin<T: ActPlugin + 'static + Clone>(&self, plugin: &T)
register plugin
§Example
use acts::{ActPlugin, Message, Engine, Workflow};
#[derive(Clone)]
struct TestPlugin;
impl TestPlugin {
fn new() -> Self {
Self
}
}
impl ActPlugin for TestPlugin {
fn on_init(&self, engine: &Engine) {
println!("TestPlugin");
engine.channel().on_start(|e| {});
engine.channel().on_complete(|e| {});
engine.channel().on_message(|e| {});
}
}
let engine = Engine::new();
engine.extender().register_plugin(&TestPlugin::new());pub fn plugins(&self) -> Arc<Mutex<Vec<Box<dyn ActPlugin>>>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Extender
impl !RefUnwindSafe for Extender
impl Send for Extender
impl Sync for Extender
impl Unpin for Extender
impl !UnwindSafe for Extender
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more