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 VMCallerCheckedFuncRef 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 VMCallerCheckedFuncRef 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_host_func_context( ptr: *mut VMHostFuncContext ) -> *mut VMOpaqueContext

Helper function to clearly indicate that casts are desired.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.