mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-06-21 18:51:52 +00:00
Host module sketch
This commit is contained in:
@ -4,6 +4,7 @@ use elements::Module;
|
||||
use interpreter::Error;
|
||||
use interpreter::module::{ExecutionParams};
|
||||
use interpreter::store::{Store, ModuleId};
|
||||
use interpreter::host::HostModuleBuilder;
|
||||
|
||||
/// Program instance. Program is a set of instantiated modules.
|
||||
pub struct ProgramInstance {
|
||||
@ -42,6 +43,10 @@ impl ProgramInstance {
|
||||
Ok(module_id)
|
||||
}
|
||||
|
||||
pub fn with_host_module<St: 'static>(&mut self, name: &str) -> HostModuleBuilder<St> {
|
||||
HostModuleBuilder::new(&mut self.store)
|
||||
}
|
||||
|
||||
/// Get one of the modules by name
|
||||
pub fn module(&self, name: &str) -> Option<ModuleId> {
|
||||
self.modules.get(name).cloned()
|
||||
|
Reference in New Issue
Block a user