Documentation and style in runtime

This commit is contained in:
Brandon Fish
2019-01-19 01:03:07 -06:00
parent 6cf68d63ac
commit 3d65656f85
4 changed files with 5 additions and 4 deletions

View File

@ -111,7 +111,7 @@ impl<'a> ExportIter<'a> {
Self { Self {
inner, inner,
iter: module.exports.iter(), iter: module.exports.iter(),
module: module, module,
} }
} }
} }

View File

@ -24,6 +24,7 @@ pub(crate) struct InstanceInner {
vmctx: Box<vm::Ctx>, vmctx: Box<vm::Ctx>,
} }
/// A WebAssembly instance
pub struct Instance { pub struct Instance {
pub module: Rc<ModuleInner>, pub module: Rc<ModuleInner>,
inner: Box<InstanceInner>, inner: Box<InstanceInner>,

View File

@ -31,7 +31,7 @@ pub use self::instance::Instance;
pub use self::module::Module; pub use self::module::Module;
use std::rc::Rc; use std::rc::Rc;
/// Compile a webassembly module using the provided compiler. /// Compile a WebAssembly module using the provided compiler.
pub fn compile(wasm: &[u8], compiler: &dyn backend::Compiler) -> CompileResult<module::Module> { pub fn compile(wasm: &[u8], compiler: &dyn backend::Compiler) -> CompileResult<module::Module> {
compiler compiler
.compile(wasm) .compile(wasm)

View File

@ -14,7 +14,7 @@ use crate::{
use hashbrown::HashMap; use hashbrown::HashMap;
use std::rc::Rc; use std::rc::Rc;
/// This is used to instantiate a new webassembly module. /// This is used to instantiate a new WebAssembly module.
#[doc(hidden)] #[doc(hidden)]
pub struct ModuleInner { pub struct ModuleInner {
pub func_resolver: Box<dyn FuncResolver>, pub func_resolver: Box<dyn FuncResolver>,
@ -47,7 +47,7 @@ impl Module {
Module(inner) Module(inner)
} }
/// Instantiate a webassembly module with the provided imports. /// Instantiate a WebAssembly module with the provided imports.
pub fn instantiate(&self, imports: Imports) -> Result<Instance> { pub fn instantiate(&self, imports: Imports) -> Result<Instance> {
Instance::new(Rc::clone(&self.0), Box::new(imports)) Instance::new(Rc::clone(&self.0), Box::new(imports))
} }