Struct wasmer_runtime_core_x::DynFunc

source ·
pub struct DynFunc<'a> { /* private fields */ }
Expand description

A representation of an exported WebAssembly function.

Implementations§

source§

impl<'a> DynFunc<'a>

source

pub fn call(&self, params: &[Value]) -> CallResult<Vec<Value>>

Call an exported WebAssembly function safely.

Pass arguments by wrapping each one in the Value enum. The returned values are also each wrapped in a Value.

§Note:

This returns CallResult<Vec<Value>> in order to support the future multi-value returns WebAssembly feature.

§Usage:
instance
    .dyn_func("foo")?
    .call(&[])?;
source

pub fn signature(&self) -> &FuncSig

Gets the signature of this Dynfunc.

source

pub fn raw(&self) -> *const Func

Gets a const pointer to the function represent by this DynFunc.

Trait Implementations§

source§

impl<'a> Exportable<'a> for DynFunc<'a>

source§

fn get_self(exports: &'a Exports, name: &str) -> ResolveResult<Self>

Implementation of how to get the export corresponding to the implementing type from an [Instance] by name.
source§

impl<'a> From<DynFunc<'a>> for Anyfunc<'a>

source§

fn from(function: DynFunc<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> TryFrom<Anyfunc<'a>> for DynFunc<'a>

§

type Error = ()

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

fn try_from(anyfunc: Anyfunc<'a>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'a> Freeze for DynFunc<'a>

§

impl<'a> !RefUnwindSafe for DynFunc<'a>

§

impl<'a> !Send for DynFunc<'a>

§

impl<'a> !Sync for DynFunc<'a>

§

impl<'a> Unpin for DynFunc<'a>

§

impl<'a> !UnwindSafe for DynFunc<'a>

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> Same for T

§

type Output = T

Should always be Self
source§

impl<'a, F> StorableInTable for F
where F: Into<Anyfunc<'a>> + TryFrom<Anyfunc<'a>>,

source§

fn unwrap_self( storage: &TableStorage, index: u32 ) -> Result<F, TableAccessError>

Attempt to lookup self in the given table.
source§

fn wrap_self( self, storage: &mut TableStorage, index: u32 ) -> Result<(), TableAccessError>

Wrap value to be stored in a table.
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.