Refine the runtime api and document the exposed items (#115)

* private module, remove unused method, docs on compile_with

* refine runtime api and document exposed items

* Fix integration test build

* Fix lint
This commit is contained in:
Lachlan Sneff
2019-01-23 12:34:15 -08:00
committed by GitHub
parent 7632beced8
commit ab65477d1f
10 changed files with 205 additions and 53 deletions

View File

@ -42,7 +42,12 @@ pub mod prelude {
pub use crate::{export_func, imports};
}
/// Compile a webassembly module using the provided compiler.
/// Compile a [`Module`] using the provided compiler from
/// WebAssembly binary code. This function is useful if it
/// is necessary to a compile a module before it can be instantiated
/// and must be used if you wish to use a different backend from the default.
///
/// [`Module`]: struct.Module.html
pub fn compile_with(
wasm: &[u8],
compiler: &dyn backend::Compiler,
@ -53,9 +58,9 @@ pub fn compile_with(
.map(|inner| module::Module::new(Rc::new(inner)))
}
/// This function performs validation as defined by the
/// WebAssembly specification and returns true if validation
/// succeeded, false if validation failed.
/// Perform validation as defined by the
/// WebAssembly specification. Returns `true` if validation
/// succeeded, `false` if validation failed.
pub fn validate(wasm: &[u8]) -> bool {
use wasmparser::WasmDecoder;
let mut parser = wasmparser::ValidatingParser::new(wasm, None);