Struct wasmtime_runtime::VMOpaqueContext
source · [−]pub struct VMOpaqueContext { /* private fields */ }
Expand description
An “opaque” version of VMContext
which must be explicitly casted to a
target context.
This context is used to represent that contexts specified in
VMCallerCheckedAnyfunc
can have any type and don’t have an implicit
structure. Neither wasmtime nor cranelift-generated code can rely on the
structure of an opaque context in general and only the code which configured
the context is able to rely on a particular structure. This is because the
context pointer configured for VMCallerCheckedAnyfunc
is guaranteed to be
the first parameter passed.
Note that Wasmtime currently has a layout where all contexts that are casted to an opaque context start with a 32-bit “magic” which can be used in debug mode to debug-assert that the casts here are correct and have at least a little protection against incorrect casts.
Implementations
sourceimpl VMOpaqueContext
impl VMOpaqueContext
sourcepub fn from_vmcontext(ptr: *mut VMContext) -> *mut VMOpaqueContext
pub fn from_vmcontext(ptr: *mut VMContext) -> *mut VMOpaqueContext
Helper function to clearly indicate that casts are desired.
sourcepub fn from_vm_host_func_context(
ptr: *mut VMHostFuncContext
) -> *mut VMOpaqueContext
pub fn from_vm_host_func_context(
ptr: *mut VMHostFuncContext
) -> *mut VMOpaqueContext
Helper function to clearly indicate that casts are desired.
Auto Trait Implementations
impl RefUnwindSafe for VMOpaqueContext
impl Send for VMOpaqueContext
impl Sync for VMOpaqueContext
impl !Unpin for VMOpaqueContext
impl UnwindSafe for VMOpaqueContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more