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 VMFuncRef 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 VMFuncRef 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§

source§

impl VMOpaqueContext

source

pub fn from_vmcontext(ptr: *mut VMContext) -> *mut VMOpaqueContext

Helper function to clearly indicate that casts are desired.

source

pub fn from_vm_array_call_host_func_context( ptr: *mut VMArrayCallHostFuncContext ) -> *mut VMOpaqueContext

Helper function to clearly indicate that casts are desired.

source

pub fn from_vm_native_call_host_func_context( ptr: *mut VMNativeCallHostFuncContext ) -> *mut VMOpaqueContext

Helper function to clearly indicate that casts are desired.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.