How to execute TIScript callback from Rust?
GirkovArpa opened this issue · 2 comments
GirkovArpa commented
view.foo("foo", function(result) {
stdout.println("result:", result);
});
impl EventHandler {
fn foo(&self, filename: String, callback: sciter::Value) -> sciter::Value {
image_magick_test();
callback.call(None, &make_args!(1, "2", 3.0), Some(file!())).unwrap();
sciter::Value::from(bar(filename.as_str()))
}
}
impl sciter::EventHandler for EventHandler {
dispatch_script_call! (
fn foo(String, sciter::Value);
);
}
fn bar(filename: &str) -> &str {
return filename;
}
When I do cargo run
, I get an error at fn foo(String, sciter::Value)
saying that "no rules expected this token in macro call" (referring to sciter::Value
).
GirkovArpa commented
I know it's not a minimal reproducible example, but if it's unclear I can simplify it further.
GirkovArpa commented
I found an example at rust-sciter/examples/threads.rs
.