fizzyx 0.1.1

Safe, ergonomic Rust bindings for the Fizzy WebAssembly interpreter.
Documentation
//! Safe, ergonomic Rust bindings for the [Fizzy] WebAssembly interpreter.
//!
//! Fizzy is a small, fast, deterministic interpreter for the WebAssembly 1.0
//! (MVP) specification. This crate wraps its C API with an interface inspired by
//! [`wasmi`] and [`wasmtime`].
//!
//! # Example
//!
//! ```
//! use fizzyx::{Engine, Linker, Module, Val};
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let wat = r#"(module (func (export "add") (param i32 i32) (result i32)
//!     local.get 0
//!     local.get 1
//!     i32.add))"#;
//! let wasm = wat::parse_str(wat)?;
//!
//! let engine = Engine::default();
//! let module = Module::new(&wasm)?;
//! let linker = Linker::new(&engine);
//! let mut instance = linker.instantiate(&module)?;
//!
//! let add = instance.get_func("add").expect("missing export");
//! let mut results = [Val::I32(0)];
//! add.call(&mut instance, &[Val::I32(1), Val::I32(2)], &mut results)?;
//! assert_eq!(results[0], Val::I32(3));
//! # Ok(())
//! # }
//! ```
//!
//! # Relationship to `wasmi`/`wasmtime`
//!
//! The API deliberately follows Fizzy's own model rather than forcing a perfect
//! match:
//!
//! - Fizzy targets WebAssembly 1.0, so a function returns **at most one** result.
//! - Instances are self-contained (they own their memory and globals), so there
//!   is **no `Store`** type. Methods that mutate an instance take `&mut Instance`
//!   directly.
//! - Imports are resolved by `module::name` at instantiation time via a
//!   [`Linker`]. Only **function imports** are currently supported.
//!
//! [Fizzy]: https://github.com/wasmx/fizzy
//! [`wasmi`]: https://docs.rs/wasmi
//! [`wasmtime`]: https://docs.rs/wasmtime

mod engine;
mod error;
mod func;
mod global;
mod instance;
mod linker;
mod memory;
mod module;
mod trampoline;
mod value;

pub use self::engine::{Config, DEFAULT_MEMORY_PAGES_LIMIT, Engine};
pub use self::error::{Error, Result};
pub use self::func::Func;
pub use self::global::Global;
pub use self::instance::Instance;
pub use self::linker::Linker;
pub use self::memory::{Memory, PAGE_SIZE};
pub use self::module::{ExportType, ExternKind, ExternType, ImportType, Module};
pub use self::value::{FuncType, GlobalType, MemoryType, Mutability, Val, ValType};