[][src]Struct wasmer_runtime::ImportObject

pub struct ImportObject { /* fields omitted */ }

All of the import data used when instantiating.

It's suggested that you use the imports! macro instead of creating an ImportObject by hand.

Usage:

let import_object = imports! {
    "env" => {
        "foo" => foo<[i32] -> [i32]>,
    },
};

extern fn foo(n: i32, _: &mut Ctx) -> i32 {
    n
}

Methods

impl ImportObject
[src]

pub fn new() -> ImportObject
[src]

Create a new ImportObject.

pub fn register<S, N>(
    &mut self,
    name: S,
    namespace: N
) -> Option<Box<dyn LikeNamespace + 'static>> where
    N: LikeNamespace + 'static,
    S: Into<String>, 
[src]

Register anything that implements LikeNamespace as a namespace.

Usage:

fn register(instance: Instance, namespace: Namespace) {
    let mut import_object = ImportObject::new();

    import_object.register("namespace0", instance);
    import_object.register("namespace1", namespace);
    // ...
}

pub fn get_namespace(
    &mut self,
    namespace: &str
) -> Option<&mut (dyn LikeNamespace + 'static)>
[src]

Auto Trait Implementations

impl !Send for ImportObject

impl !Sync for ImportObject

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
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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