Wereii
Wereii7mo ago

rusty_v8 - how to pass data from js/v8 into rust

Hello, I am playing with rusty_v8, by following the examples I was able to get js eval up and running quite nicely. Now, I am trying out Function/FunctionTemplate stuff and I tried to do this (simplified and wrong):
let mut buffer = String::new();

FunctionTemplate::new(&mut handle_scope, |scope, args, _retval|{
// extract args
buffer.push(some_data);
})
let mut buffer = String::new();

FunctionTemplate::new(&mut handle_scope, |scope, args, _retval|{
// extract args
buffer.push(some_data);
})
This won't compile because only Fn type is accepted, not FnMut (which makes sense). Am I missing something trivial or is there some other way to do this? I tried set_slot/get_slot but I don't think I am using it right (or even for the right purpose?) as I am getting assertion errors from the internal hashmap. Thanks a lot for any pointers!
3 Replies
foobar
foobar7mo ago
Stack Overflow
WASM & Deno / Extract and manipulate Array of Date
I try to extract and manipulate an array of date in a function in WASM project for Deno The rust function doesn't compile. How to manipulate Date and convert it ? Does someone have a repository/lin...
foobar
foobar7mo ago
not function but maybe can help
Wereii
Wereii7mo ago
thanks @foobar but that does not seem to be even remotely touching rusty_v8/v8 apis