webassembly-rs
A Rust library provide opcode values and conversions of foundation types (i32,f64,etc.) used at the bytecode level in WebAssembly. This is mostly meant to be used by compilers, interpreters, parsers, encoders. For a more powerful library, checkout watson.
- depends only on
#![no_std]andalloc - includes all opcodes
- full parser and encoder
- tested against real WebAssembly binaries
Usage
[]
= "0.8"
Testing with Official Spec
# Quick test (15 unit tests)
# Full test with spec suite (17 tests total)
# Or use make targets
Test Results
✓ 15 unit tests - LEB128, section parsing, round-trips, real wasm files ✓ 2 spec integration tests - Parses 7 official test binaries:
- sample.wasm (from WebAssembly/spec repo)
- minimal, type_only, import_only, memory_only, export_only, custom_only
Setup (optional - for updating spec tests)
# Already set up! But to update to latest spec tests:
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in webassembly by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.