A WebAssembly interpeter. I haven't touched this in a while, but I thought I'd still make it public cause why not
- WebAssembly 81.4%
- Rust 18.6%
|
Cyborus04
9d7b8ea788
use `parking_lot::RwLock` for tables |
||
|---|---|---|
| .github/workflows | reduce rustc jobs used in CI | |
| benches | Update memory access ( #21 ) | |
| benchmark | improve benchmarks | |
| src |
use parking_lot::RwLock for tables
|
|
| .gitignore | improve benchmarks | |
| Cargo.toml | Update memory access ( #21 ) | |
| LICENSE-APACHE | Initial Commit | |
| LICENSE-MIT | Initial Commit | |
| README.md | add pronunciation tip | |
waphite
waphite (like "graphite") is a crate for executing WebAssembly
Usage
Add the following to your Cargo.toml:
[dependencies]
waphite = "0.1"
Examples
Basic Import:
letbytes=include_bytes!("add.wasm");letinstance=waphite::instantiate::<Contiguous,()>(bytes,vec![],()).expect("Failed to import `add.wasm`");leta: u8 =instance.call("add_two",&[4.into()]).unwrap()[0].into();assert_eq!(a,6);Features
By default, the instance, memory, stacktrace, and
helper_macros features are all enabled. Disabling default features leaves this
crate entirely empty, allowing you to get only the pieces you need. For example,
if you just need WASM memory, then you can enable only the memory feature.
List of all default features (and their dependencies):
memory- Enables thememorymodule.wasm_value- Enables theWasmValuetype.instance- (requiresmemoryandwasm_value) Enables theWasmInstancetype and everything related to it.helper_macros- (requiresinstance) Enables theexportsandcallmacros.stacktrace- (requiresinstance) Enables theWasmStacktracetype.
List of all non-default features
experimental- Enables theexperimentalmodule.call_async- Enables variousasyncways of calling WASM functions
To get the most bare-bones version of this crate that can still execute WASM,
enabling the engine feature is all you need to do.
License
This project is licensed under either of
at your option.