fixed doc comments

This commit is contained in:
Able 2021-11-27 20:14:40 -06:00
parent f22b55e2b6
commit 7915ee7b11

View file

@ -25,12 +25,12 @@ impl Externals for HostFunctions {
args: RuntimeArgs, args: RuntimeArgs,
) -> Result<Option<RuntimeValue>, Trap> { ) -> Result<Option<RuntimeValue>, Trap> {
match index.into() { match index.into() {
/// Take in one arg discard the rest // Take in one arg discard the rest
SysCall::KILL => { SysCall::KILL => {
println!("hewwo"); println!("Program killed");
Ok(None) Ok(None)
} }
/// Do nothing // Do nothing
SysCall::EMPTY => Ok(None), SysCall::EMPTY => Ok(None),
SysCall::EXIT => Ok(None), SysCall::EXIT => Ok(None),
SysCall::CONSOLE_RESET => Ok(None), SysCall::CONSOLE_RESET => Ok(None),
@ -71,8 +71,9 @@ impl ModuleImportResolver for HostFunctions {
} }
fn main() { fn main() {
let wasm_binary = include_bytes!("../wasm/rust.wasm"); let wasm_binary = // Spacer
// include_bytes!("../wasm/zig.wasm"); // include_bytes!("../wasm/rust.wasm");
include_bytes!("../wasm/zig.wasm");
// include_bytes!("../wasm/c.wasm"); // include_bytes!("../wasm/c.wasm");
// include_bytes!("../wasm/wasm.wasm"); // include_bytes!("../wasm/wasm.wasm");
@ -89,13 +90,13 @@ fn main() {
// Finally, invoke the exported function "test" with no parameters // Finally, invoke the exported function "test" with no parameters
// and empty external function executor. // and empty external function executor.
let result = instance let result: i32 = instance
.invoke_export("_start", &[], &mut HostFunctions) .invoke_export("_start", &[], &mut HostFunctions)
// .with_resolver(&mut HostFunctions) // .with_resolver(&mut HostFunctions)
.expect("failed to execute export"); .expect("failed to execute export")
/*.unwrap() .unwrap()
.try_into() .try_into()
.unwrap();*/ .unwrap();
println!( println!(
"{:?}", "{:?}",