pub struct EngineBuilder { /* private fields */ }Implementations§
Source§impl EngineBuilder
impl EngineBuilder
pub fn new() -> Self
pub fn set_config_source(self, source: &Path) -> Self
pub fn log(self, dir: &str, level: &str) -> Self
pub fn cache_size(self, size: i64) -> Self
pub fn tick_interval_secs(self, secs: i64) -> Self
pub fn max_message_retry_times(self, retry_times: i32) -> Self
Sourcepub fn add_plugin<T>(self, plugin: &T) -> Self
pub fn add_plugin<T>(self, plugin: &T) -> Self
register plugin
§Example
use acts::{ActPlugin, Message, Engine, EngineBuilder, Workflow, Result};
#[derive(Clone)]
struct TestPlugin;
impl TestPlugin {
fn new() -> Self {
Self
}
}
#[async_trait::async_trait]
impl ActPlugin for TestPlugin {
async fn on_init(&self, engine: &Engine) -> Result<()> {
println!("TestPlugin");
engine.channel().on_start(|e| {});
engine.channel().on_complete(|e| {});
engine.channel().on_message(|e| {});
Ok(())
}
}
#[tokio::main]
async fn main() {
let engine = EngineBuilder::new().add_plugin(&TestPlugin::new()).build().await.unwrap().start();
}pub async fn build(&self) -> Result<Engine>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EngineBuilder
impl !RefUnwindSafe for EngineBuilder
impl Send for EngineBuilder
impl Sync for EngineBuilder
impl Unpin for EngineBuilder
impl UnsafeUnpin for EngineBuilder
impl !UnwindSafe for EngineBuilder
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> 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