Add error types and convert most results to wasmer-runtime results

This commit is contained in:
Lachlan Sneff
2019-01-18 09:17:44 -08:00
parent f5ab605878
commit d23601a810
11 changed files with 303 additions and 80 deletions

View File

@ -7,6 +7,7 @@ mod macros;
#[doc(hidden)]
pub mod backend;
mod backing;
pub mod error;
pub mod export;
pub mod import;
mod instance;
@ -23,13 +24,14 @@ pub mod vm;
#[doc(hidden)]
pub mod vmcalls;
use self::error::CompileResult;
pub use self::instance::Instance;
#[doc(inline)]
pub use self::module::Module;
use std::rc::Rc;
/// Compile a webassembly module using the provided compiler.
pub fn compile(wasm: &[u8], compiler: &dyn backend::Compiler) -> Result<module::Module, String> {
pub fn compile(wasm: &[u8], compiler: &dyn backend::Compiler) -> CompileResult<module::Module> {
compiler
.compile(wasm)
.map(|inner| module::Module::new(Rc::new(inner)))