clean up implementation

This commit is contained in:
Mark McCaskey
2019-03-27 14:01:27 -07:00
parent f9a29445ca
commit 09068c1a74
11 changed files with 109 additions and 58 deletions

View File

@ -110,7 +110,7 @@ pub mod units {
pub mod cache;
use wasmer_runtime_core::backend::Compiler;
use wasmer_runtime_core::backend::{Compiler, CompilerConfig};
/// Compile WebAssembly binary code into a [`Module`].
/// This function is useful if it is necessary to
@ -129,6 +129,13 @@ pub fn compile(wasm: &[u8]) -> error::CompileResult<Module> {
wasmer_runtime_core::compile_with(&wasm[..], default_compiler())
}
pub fn compile_with_config(
wasm: &[u8],
compiler_config: CompilerConfig,
) -> error::CompileResult<Module> {
wasmer_runtime_core::compile_with_config(&wasm[..], default_compiler(), compiler_config)
}
/// Compile and instantiate WebAssembly code without
/// creating a [`Module`].
///
@ -149,7 +156,7 @@ pub fn compile(wasm: &[u8]) -> error::CompileResult<Module> {
/// depending on the cause of the failure.
pub fn instantiate(wasm: &[u8], import_object: &ImportObject) -> error::Result<Instance> {
let module = compile(wasm)?;
module.instantiate(import_object, None)
module.instantiate(import_object)
}
/// Get a single instance of the default compiler to use.