[−][src]Struct wasmer_runtime::ImportObject
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" => func!(foo), }, }; fn foo(_: &mut Ctx, n: i32) -> 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]
&mut self,
name: S,
namespace: N
) -> Option<Box<dyn LikeNamespace + 'static>> where
N: LikeNamespace + 'static,
S: Into<String>,
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(
&self,
namespace: &str
) -> Option<&(dyn LikeNamespace + 'static)>
[src]
&self,
namespace: &str
) -> Option<&(dyn LikeNamespace + 'static)>
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]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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.