wasm_interp: simplified ImportDispatcher

We don't really need a trait for the 'import module' concept.
This commit is contained in:
Brian Carroll 2022-12-01 08:47:32 +00:00
parent ec8950816a
commit b10ac827f1
No known key found for this signature in database
GPG key ID: 5C7B2EC4101703C0
2 changed files with 67 additions and 85 deletions

View file

@ -2,9 +2,25 @@ mod call_stack;
mod instance;
pub mod test_utils;
mod value_stack;
mod wasi;
pub mod wasi;
// Main external interface
pub use instance::Instance;
// Exposed for testing only. Should eventually become private.
pub use call_stack::CallStack;
pub use instance::{Action, Instance};
pub use instance::Action;
pub use value_stack::ValueStack;
use roc_wasm_module::Value;
pub trait ImportDispatcher {
/// Dispatch a call from WebAssembly to your own code, based on module and function name.
fn dispatch(
&mut self,
module_name: &str,
function_name: &str,
arguments: &[Value],
memory: &mut [u8],
) -> Option<Value>;
}