You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Except for parsing the text format, the implementation is complete, i.e., all the specification is implemented and the official test suite is fully covered (as of 2019-10-27).
Getting Started
The project is composed of a library (rust_wasm) as well as a test suite.
The official embedding API is supported.
Because the API specification is written in a pure style, we slightly modified it to best fit Rust (e.g., using mutable reference instead of returning a new store each time).
Invoking the main function
use rust_wasm::*;use std::fs::File;use std::io::BufReader;fnmain(){letmut store = init_store();let f = File::open("filename").unwrap();let module = decode_module(BufReader::new(f)).unwrap();let module_instance = instantiate_module(&mut store, module,&[]).unwrap();ifletExternVal::Func(main_addr) = get_export(&module_instance,"main").unwrap(){let res = invoke_func(&mut store, main_addr,Vec::new());println!("{:?}", res);}}
Listing module exports/imports
use rust_wasm::*;use std::fs::File;use std::io::BufReader;fnmain(){let f = File::open("filename").unwrap();let module = decode_module(BufReader::new(f)).unwrap();let mod_exports = module_exports(&module);let mod_imports = module_imports(&module);}