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
Create an empty ImportsBuilder
.
pub 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.
pub 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
Resolve a function. Read more
fn 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
fn 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
fn 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
Mutably borrows from an owned value. Read more
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more