From d08750034a582b7ef338432a360c62a2969f6aa0 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Sat, 9 Dec 2023 14:56:03 +0100 Subject: chore: improve documentation Signed-off-by: Henry Gressmann --- crates/parser/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 crates/parser/README.md (limited to 'crates/parser/README.md') 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(); +``` -- cgit v1.3.1