1
0
Fork
You've already forked waphite
0
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
Merge pull request #25 from Cyborus04/parking_lot_tables
use `parking_lot::RwLock` for tables
2023年05月21日 14:16:15 -04:00
.github/workflows reduce rustc jobs used in CI 2022年05月10日 12:05:57 -04:00
benches Update memory access ( #21 ) 2023年05月21日 14:01:10 -04:00
benchmark improve benchmarks 2021年12月28日 17:08:12 -05:00
src use parking_lot::RwLock for tables 2023年05月21日 14:12:06 -04:00
.gitignore improve benchmarks 2021年12月28日 17:08:12 -05:00
Cargo.toml Update memory access ( #21 ) 2023年05月21日 14:01:10 -04:00
LICENSE-APACHE Initial Commit 2021年10月26日 20:37:56 -04:00
LICENSE-MIT Initial Commit 2021年10月26日 20:37:56 -04:00
README.md add pronunciation tip 2022年09月07日 01:34:23 -04:00

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 the memory module.
  • wasm_value - Enables the WasmValue type.
  • instance - (requires memory and wasm_value) Enables the WasmInstance type and everything related to it.
  • helper_macros - (requires instance) Enables the exports and call macros.
  • stacktrace - (requires instance) Enables the WasmStacktrace type.

List of all non-default features

  • experimental - Enables the experimental module.
  • call_async - Enables various async ways 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.