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.
let import_object = imports! {
"env" => {
"foo" => foo<[i32] -> [i32]>,
},
};
extern fn foo(n: i32, _: &mut Ctx) -> i32 {
n
}
Create a new ImportObject
.
Register anything that implements LikeNamespace
as a namespace.
fn register(instance: Instance, namespace: Namespace) {
let mut import_object = ImportObject::new();
import_object.register("namespace0", instance);
import_object.register("namespace1", namespace);
}
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static