WereiiW
Denoβ€’2y agoβ€’
3 replies
Wereii

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


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!
Was this page helpful?