Suppose we have a JS function
function foo(x) {
console.log("Yo, JS side says: ", x);
}
Now, suppose we want it pass it to Rust. The Rust 'receiver' would be something like:
struct Rust_Part {}
impl Rust_Part {
pub fn rust_handler(callback: &JsValue) { ... }
}
}
Here's my question. How do we use the 'callback' on the Rust side? I want to do something like:
callback(&"hello world".into::<JsValue>());
except callback
itself is a JsValue, and not a function.
Question: how do we use callback
on the Rust side ?