diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2023-12-09 14:56:03 +0100 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2023-12-09 14:56:03 +0100 |
| commit | d08750034a582b7ef338432a360c62a2969f6aa0 (patch) | |
| tree | 577296351a97ed044dd2ceabc7d772c42cf21c0f /crates/parser/README.md | |
| parent | ea0a362c585c2a2da39ec8fbafacd79c17680665 (diff) | |
chore: improve documentation
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates/parser/README.md')
| -rw-r--r-- | crates/parser/README.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/parser/README.md b/crates/parser/README.md new file mode 100644 index 0000000..5772bb7 --- /dev/null +++ b/crates/parser/README.md @@ -0,0 +1,21 @@ +# `tinywasm_parser` + +This crate provides a parser that can parse WebAssembly modules into a TinyWasm module. It is based on +[`wasmparser_nostd`](https://crates.io/crates/wasmparser_nostd) and used by [`tinywasm`](https://crates.io/crates/tinywasm). + +## Features + +- `std`: Enables the use of `std` and `std::io` for parsing from files and streams. +- `logging`: Enables logging of the parsing process using the `log` crate. + +## Usage + +```rust +use tinywasm_parser::{Parser, TinyWasmModule}; +let bytes = include_bytes!("./file.wasm"); + +let parser = Parser::new(); +let module: TinyWasmModule = parser.parse_module_bytes(bytes).unwrap(); +let mudule: TinyWasmModule = parser.parse_module_file("path/to/file.wasm").unwrap(); +let module: TinyWasmModule = parser.parse_module_stream(&mut stream).unwrap(); +``` |
