From 735c7cb636edfd4704460c94a9c7d65e5bf4df48 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Sat, 9 Mar 2024 13:51:32 +0100 Subject: chore: improve documentation, tests Closes #6 Signed-off-by: Henry Gressmann --- crates/parser/src/lib.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'crates/parser/src/lib.rs') diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs index 7beb5f8..5fb3c48 100644 --- a/crates/parser/src/lib.rs +++ b/crates/parser/src/lib.rs @@ -8,9 +8,11 @@ #![cfg_attr(not(feature = "std"), feature(error_in_core))] //! See [`tinywasm`](https://docs.rs/tinywasm) for documentation. -mod std; extern crate alloc; +#[cfg(feature = "std")] +extern crate std; + // log for logging (optional). #[cfg(feature = "logging")] #[allow(clippy::single_component_path_imports)] @@ -32,7 +34,7 @@ mod visit; use alloc::{string::ToString, vec::Vec}; pub use error::*; use module::ModuleReader; -use tinywasm_types::{TypedWasmFunction, WasmFunction}; +use tinywasm_types::WasmFunction; use wasmparser::{Validator, WasmFeatures}; pub use tinywasm_types::TinyWasmModule; @@ -156,13 +158,10 @@ impl TryFrom for TinyWasmModule { .code .into_iter() .zip(code_type_addrs) - .map(|((instructions, locals), ty_idx)| TypedWasmFunction { - type_addr: ty_idx, - wasm_function: WasmFunction { - instructions, - locals, - ty: reader.func_types.get(ty_idx as usize).expect("No func type for func, this is a bug").clone(), - }, + .map(|((instructions, locals), ty_idx)| WasmFunction { + instructions, + locals, + ty: reader.func_types.get(ty_idx as usize).expect("No func type for func, this is a bug").clone(), }) .collect::>(); @@ -175,7 +174,6 @@ impl TryFrom for TinyWasmModule { globals: globals.into_boxed_slice(), table_types: table_types.into_boxed_slice(), imports: reader.imports.into_boxed_slice(), - version: reader.version, start_func: reader.start_func, data: reader.data.into_boxed_slice(), exports: reader.exports.into_boxed_slice(), -- cgit v1.3.1