#Persistent data

9 messages · Page 1 of 1 (latest)

gleaming pendant
#

According to the V8 documentation, if I want an object to exist across multiple independent operations I'd have to use a Persistent handle although I see no references to it outside of a few documentation mentions here: https://github.com/denoland/rusty_v8/search?q=persistent

Am I supposed to do it in a different way with Deno?

GitHub

Rust bindings for the V8 JavaScript engine. Contribute to denoland/rusty_v8 development by creating an account on GitHub.

hard pelican
#

Some of the differences between handle types in V8 are the way they are because of C++ semantics, not all of which map cleanly to Rust

#

For a handle to exist across multiple independent operations, in rusty_v8 you'd use a v8::Global

paper condor
#

And specifically the reason is that Persistent has copy semantics while Global has move semantics. How that relates to rusty_v8 needing to use Global instead of Persistent I'm not quite sure, though 🙂

hard pelican
#

Rust's move semantics are just changing ownership

#

which you can do with Global

#

and you can also clone a Global

#

so I guess that's fine?