Struct wasmer::ImportObject [−][src]
pub struct ImportObject { /* fields omitted */ }
Expand description
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:
ⓘ
use wasmer::{Exports, ImportObject, Function};
let mut import_object = ImportObject::new();
let mut env = Exports::new();
env.insert("foo", Function::new_native(foo));
import_object.register("env", env);
fn foo(n: i32) -> i32 {
n
}
Implementations
Gets an export given a module and a name
Usage
ⓘ
let mut import_object = ImportObject::new();
import_object.get_export("module", "name");
Returns true if the ImportObject contains namespace with the provided name.
pub fn register<S, N>(
&mut self,
name: S,
namespace: N
) -> Option<Box<dyn LikeNamespace>> where
S: Into<String>,
N: LikeNamespace + 'static,
pub fn register<S, N>(
&mut self,
name: S,
namespace: N
) -> Option<Box<dyn LikeNamespace>> where
S: Into<String>,
N: LikeNamespace + 'static,
Register anything that implements LikeNamespace
as a namespace.
Usage:
ⓘ
let mut import_object = ImportObject::new();
import_object.register("namespace0", instance);
import_object.register("namespace1", namespace);
// ...
Trait Implementations
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for ImportObject
impl !Send for ImportObject
impl !Sync for ImportObject
impl Unpin for ImportObject
impl UnwindSafe for ImportObject
Blanket Implementations
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more