working proof of concept
This commit is contained in:
parent
9a86073066
commit
9efcf6b526
6 changed files with 39 additions and 18 deletions
|
@ -7,8 +7,9 @@ edition = "2021"
|
|||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
tokio = "1.39.3"
|
||||
tracing = "0.1.40"
|
||||
gpt-sandbox = { path = "../../" }
|
||||
#tokio = "1.39.3"
|
||||
#tracing = "0.1.40"
|
||||
host_tools = {path="../../host_tools"}
|
||||
#gpt-sandbox = { path = "../../" }
|
||||
async-trait = "0.1.81"
|
||||
once_cell = "1.19.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
use gpt_sandbox::{AsyncFn, Plugin, PluginResult, RegisterFn};
|
||||
use host_tools::{tokio::task::JoinHandle, tracing::info, AsyncFn, Plugin, PluginResult, RegisterFn};
|
||||
use std::collections::HashMap;
|
||||
use tokio::runtime::Handle;
|
||||
use host_tools::tokio::runtime::Handle;
|
||||
|
||||
#[allow(improper_ctypes_definitions)] // will never be used by c programs, would use rust dylib if it existed
|
||||
#[no_mangle]
|
||||
|
@ -24,11 +24,11 @@ impl Plugin for ExamplePlugin {
|
|||
}
|
||||
}
|
||||
|
||||
fn example_function(handle: Handle) -> tokio::task::JoinHandle<PluginResult> {
|
||||
println!("start of example_function");
|
||||
fn example_function(handle: Handle) -> JoinHandle<PluginResult> {
|
||||
info!("start of example_function");
|
||||
|
||||
handle.spawn(async {
|
||||
println!("task running");
|
||||
info!("task running");
|
||||
PluginResult::Ok
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue