Struct wasmi::ImportsBuilder [−][src]
Convenience builder of ImportResolver
.
With help of this builder, you can easily create ImportResolver
, just by
adding needed resolvers by names.
Examples
use wasmi::{ModuleInstance, ImportsBuilder}; let imports = ImportsBuilder::new() .with_resolver("env", &EnvModuleResolver) // Note, that ModuleInstance can be a resolver too. .with_resolver("other_instance", &other_instance); let instance = ModuleInstance::new(&module, &imports)?.assert_no_start();
Implementations
impl<'a> ImportsBuilder<'a>
[src]
pub fn new() -> ImportsBuilder<'a>
[src]
Create an empty ImportsBuilder
.
pub fn with_resolver<N: Into<String>>(
self,
name: N,
resolver: &'a dyn ModuleImportResolver
) -> Self
[src]
self,
name: N,
resolver: &'a dyn ModuleImportResolver
) -> Self
Register an resolver by a name.
pub fn push_resolver<N: Into<String>>(
&mut self,
name: N,
resolver: &'a dyn ModuleImportResolver
)
[src]
&mut self,
name: N,
resolver: &'a dyn ModuleImportResolver
)
Register an resolver by a name.
Mutable borrowed version.
Trait Implementations
impl<'a> Default for ImportsBuilder<'a>
[src]
impl<'a> ImportResolver for ImportsBuilder<'a>
[src]
fn resolve_func(
&self,
module_name: &str,
field_name: &str,
signature: &Signature
) -> Result<FuncRef, Error>
[src]
&self,
module_name: &str,
field_name: &str,
signature: &Signature
) -> Result<FuncRef, Error>
fn resolve_global(
&self,
module_name: &str,
field_name: &str,
global_type: &GlobalDescriptor
) -> Result<GlobalRef, Error>
[src]
&self,
module_name: &str,
field_name: &str,
global_type: &GlobalDescriptor
) -> Result<GlobalRef, Error>
fn resolve_memory(
&self,
module_name: &str,
field_name: &str,
memory_type: &MemoryDescriptor
) -> Result<MemoryRef, Error>
[src]
&self,
module_name: &str,
field_name: &str,
memory_type: &MemoryDescriptor
) -> Result<MemoryRef, Error>
fn resolve_table(
&self,
module_name: &str,
field_name: &str,
table_type: &TableDescriptor
) -> Result<TableRef, Error>
[src]
&self,
module_name: &str,
field_name: &str,
table_type: &TableDescriptor
) -> Result<TableRef, Error>
Auto Trait Implementations
impl<'a> !RefUnwindSafe for ImportsBuilder<'a>
impl<'a> !Send for ImportsBuilder<'a>
impl<'a> !Sync for ImportsBuilder<'a>
impl<'a> Unpin for ImportsBuilder<'a>
impl<'a> !UnwindSafe for ImportsBuilder<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,