working proof of concept

This commit is contained in:
lever1209 2024-08-21 13:39:47 -03:00
commit 9efcf6b526
No known key found for this signature in database
GPG key ID: 0EA7B9E85212693C
6 changed files with 39 additions and 18 deletions

View file

@ -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"

View file

@ -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
})
}