[][src]Struct wasmer_runtime::Instance

pub struct Instance { /* fields omitted */ }

An instantiated WebAssembly module.

An Instance represents a WebAssembly module that has been instantiated with an ImportObject and is ready to be called.

Methods

impl Instance[src]

pub fn func<Args, Rets>(
    &self,
    name: &str
) -> Result<Func<Args, Rets, Wasm>, ResolveError> where
    Args: WasmTypeList,
    Rets: WasmTypeList
[src]

Through generic magic and the awe-inspiring power of traits, we bring you...

"Func"

A Func allows you to call functions exported from wasm with near zero overhead.

Usage:

let func: Func<(i32, i32)> = instance.func("foo")?;

func.call(42, 43);

pub fn dyn_func(&self, name: &str) -> Result<DynFunc, ResolveError>[src]

This returns the representation of a function that can be called safely.

Usage:

instance
    .dyn_func("foo")?
    .call(&[])?;

pub fn call(
    &self,
    name: &str,
    params: &[Value]
) -> Result<Vec<Value>, CallError>
[src]

Call an exported webassembly function given the export name. 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:

// ...
let results = instance.call("foo", &[Value::I32(42)])?;
// ...

pub fn context(&self) -> &Ctx[src]

Returns an immutable reference to the Ctx used by this Instance.

pub fn context_mut(&mut self) -> &mut Ctx[src]

Returns a mutable reference to the Ctx used by this Instance.

pub fn exports(&self) -> ExportIter[src]

Returns an iterator over all of the items exported from this instance.

pub fn module(&self) -> Module[src]

The module used to instantiate this Instance.

Trait Implementations

impl LikeNamespace for Instance[src]

Auto Trait Implementations

impl !Send for Instance

impl !Sync for Instance

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T