Wasmtime
|
Representation of a WebAssembly externref
value.
More...
#include <val.hh>
Public Member Functions | |
ExternRef (wasmtime_externref_t val) | |
Creates a new ExternRef directly from its C-API representation. | |
ExternRef (const ExternRef &other) | |
Copy constructor to clone other . | |
ExternRef & | operator= (const ExternRef &other) |
Copy assignment to clone from other . | |
ExternRef (ExternRef &&other) | |
Move constructor to move the contents of other . | |
ExternRef & | operator= (ExternRef &&other) |
Move assignment to move the contents of other . | |
ExternRef (Store::Context cx, std::any val) | |
std::any & | data (Store::Context cx) |
Returns the underlying host data associated with this ExternRef . | |
uint32_t | take_raw (Store::Context cx) |
uint32_t | borrow_raw (Store::Context cx) const |
Returns wasmtime_externref_to_raw . | |
Friends | |
class | Val |
Representation of a WebAssembly externref
value.
This class represents an value that cannot be forged by WebAssembly itself. All ExternRef
values are guaranteed to be created by the host and its embedding. It's suitable to place private data structures in here which WebAssembly will not have access to, only other host functions will have access to them.
Note that ExternRef
values are rooted within a Store
and must be manually unrooted via the unroot
function. If this is not used then values will never be candidates for garbage collection.
|
inlineexplicit |
Creates a new externref
value from the provided argument.
Note that val
should be safe to send across threads and should own any memory that it points to. Also note that ExternRef
is similar to a std::shared_ptr
in that there can be many references to the same value.
|
inline |
Consumes ownership of the underlying wasmtime_externref_t
and returns the result of wasmtime_externref_to_raw
.