40 lines
791 B
Rust
Raw Normal View History

2019-01-09 01:06:24 -05:00
#[cfg(test)]
#[macro_use]
extern crate field_offset;
2019-01-08 12:09:47 -05:00
#[macro_use]
2019-01-17 19:55:25 +01:00
pub mod macros;
2019-01-12 22:02:19 -05:00
#[doc(hidden)]
2019-01-12 17:53:17 -05:00
pub mod backend;
2019-01-08 12:09:47 -05:00
mod backing;
pub mod error;
2019-01-12 17:53:17 -05:00
pub mod export;
pub mod import;
2019-01-11 17:10:21 +01:00
pub mod instance;
2019-01-12 17:53:17 -05:00
pub mod memory;
mod mmap;
2019-01-12 17:53:17 -05:00
pub mod module;
2019-01-10 22:59:57 -05:00
mod recovery;
mod sig_registry;
mod sighandler;
2019-01-16 10:26:10 -08:00
pub mod structures;
2019-01-09 01:06:24 -05:00
pub mod table;
2019-01-08 12:09:47 -05:00
pub mod types;
pub mod vm;
2019-01-12 22:02:19 -05:00
#[doc(hidden)]
2019-01-08 12:09:47 -05:00
pub mod vmcalls;
use self::error::CompileResult;
2019-01-18 11:15:13 -08:00
pub use self::error::Result;
2019-01-12 17:52:14 -05:00
pub use self::instance::Instance;
2019-01-12 22:02:19 -05:00
#[doc(inline)]
pub use self::module::Module;
use std::rc::Rc;
2019-01-08 12:09:47 -05:00
2019-01-19 01:03:07 -06:00
/// Compile a WebAssembly module using the provided compiler.
pub fn compile(wasm: &[u8], compiler: &dyn backend::Compiler) -> CompileResult<module::Module> {
2019-01-12 22:02:19 -05:00
compiler
.compile(wasm)
.map(|inner| module::Module::new(Rc::new(inner)))
2019-01-08 21:57:28 -05:00
}