Embedding V8 in Rust
- This is based on using
deno_corebut a lot of it applies directly to using
rusty_v8as well, which maps somewhat to the C++ V8 API.
- Other references on embedding V8
- While using rusty_v8, you'll need to use scopes, isolates, locals and globals. This can seem confusing at first, especially when you need to get a local from a global, or when you need a scope and an isolate, but need to take mutable borrows on the engine for both at the same time.
Isolate, so you only need to explicitly get the scope from
runtime.handle_scope(), and then can use it as an isolate as well.
- Converting a
let scope = runtime.; let local = v8::Local::;
- This is useful with
serde_v8, which simplifies a lot of conversion between JS types and Rust types but needs a
Thanks for reading! If you have any questions or comments, please send me a note on Twitter. And if you enjoyed this, I also have a newsletter where I sometimes write about tech thoughts, interesting things I've read, and project updates.