eyresimpson / simx

Easy and simple flow engine
MIT License
2 stars 0 forks source link

引擎插件默认执行方法 #28

Closed eyresimpson closed 2 months ago

eyresimpson commented 2 months ago

引擎启动时除了默认流和默认脚本的执行,也考虑执行一些插件的默认操作,但可能有安全性风险

这样可以更方便的将各种复杂的内容迁移出引擎

eyresimpson commented 2 months ago

现在引擎启动时,会主动调用目标插件的 init 函数,如果需要调用async,可以按照如下方式调用:

#[no_mangle]
pub extern "C" fn init() {
    let future = async {
        // 异步逻辑写在这里
    };
    tokio::runtime::Runtime::new().unwrap().block_on(future);
}