Struct wasmi::ImportsBuilder
source · [−]pub struct ImportsBuilder<'a> { /* private fields */ }
Expand description
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
sourceimpl<'a> ImportsBuilder<'a>
impl<'a> ImportsBuilder<'a>
sourcepub fn new() -> ImportsBuilder<'a>
pub fn new() -> ImportsBuilder<'a>
Create an empty ImportsBuilder
.
sourcepub fn with_resolver<N: Into<String>>(
self,
name: N,
resolver: &'a dyn ModuleImportResolver
) -> Self
pub fn with_resolver<N: Into<String>>(
self,
name: N,
resolver: &'a dyn ModuleImportResolver
) -> Self
Register an resolver by a name.
sourcepub fn push_resolver<N: Into<String>>(
&mut self,
name: N,
resolver: &'a dyn ModuleImportResolver
)
pub fn push_resolver<N: Into<String>>(
&mut self,
name: N,
resolver: &'a dyn ModuleImportResolver
)
Register an resolver by a name.
Mutable borrowed version.
Trait Implementations
sourceimpl<'a> Default for ImportsBuilder<'a>
impl<'a> Default for ImportsBuilder<'a>
sourceimpl<'a> ImportResolver for ImportsBuilder<'a>
impl<'a> ImportResolver for ImportsBuilder<'a>
sourcefn resolve_func(
&self,
module_name: &str,
field_name: &str,
signature: &Signature
) -> Result<FuncRef, Error>
fn resolve_func(
&self,
module_name: &str,
field_name: &str,
signature: &Signature
) -> Result<FuncRef, Error>
Resolve a function. Read more
sourcefn resolve_global(
&self,
module_name: &str,
field_name: &str,
global_type: &GlobalDescriptor
) -> Result<GlobalRef, Error>
fn resolve_global(
&self,
module_name: &str,
field_name: &str,
global_type: &GlobalDescriptor
) -> Result<GlobalRef, Error>
Resolve a global variable. Read more
sourcefn resolve_memory(
&self,
module_name: &str,
field_name: &str,
memory_type: &MemoryDescriptor
) -> Result<MemoryRef, Error>
fn resolve_memory(
&self,
module_name: &str,
field_name: &str,
memory_type: &MemoryDescriptor
) -> Result<MemoryRef, Error>
Resolve a memory. Read more
sourcefn resolve_table(
&self,
module_name: &str,
field_name: &str,
table_type: &TableDescriptor
) -> Result<TableRef, Error>
fn resolve_table(
&self,
module_name: &str,
field_name: &str,
table_type: &TableDescriptor
) -> Result<TableRef, Error>
Resolve a table. Read more
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more