1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//! # zwasm-sdk
//!
//! Rust bindings for [zwasm](https://github.com/clojurewasm/zwasm): a small, fast, and spec-complete WebAssembly runtime written in Zig.
//!
//! ## Features
//! - **Tiny and fast**: ~1.2MB binary, JIT for ARM64/x86_64, full SIMD, threads, GC, exception handling, and more.
//! - **100% spec conformance**: Passes all official Wasm spec tests and proposals through 3.0.
//! - **Component Model**: WIT parser, Canonical ABI, WASI Preview 1+2, component linking.
//! - **Security**: Deny-by-default WASI, capability flags, resource limits.
//! - **Zero dependencies**: Pure Zig core, no libc required.
//! - **Interruption support**: cancel a running invocation from another thread with [`CancelHandle`].
//!
//! ## Supported platforms
//! - Linux (x86_64, aarch64)
//! - macOS (aarch64)
//! - Windows (x86_64)
//!
//! ## Example
//! ```no_run
//! use zwasm_sdk::{Module};
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let wasm_bytes: &[u8] = &[
//! 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x05, 0x01, 0x60, 0x00, 0x01,
//! 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x05, 0x01, 0x01, 0x66, 0x00, 0x00, 0x0a, 0x06,
//! 0x01, 0x04, 0x00, 0x41, 0x2a, 0x0b,
//! ];
//! let module = Module::new(wasm_bytes)?;
//! let results = module.invoke("f", &[])?;
//! assert_eq!(results[0], 42);
//! Ok(())
//! }
//! ```
//!
//! For long-running Wasm, enable cancellation in [`Config`] and use [`Module::cancel_handle`]
//! to interrupt an in-progress invocation from another thread. Interrupted calls can be
//! recognized with [`ZwasmError::is_interrupted`].
//!
//! ## Design
//! zwasm uses a 4-tier execution pipeline:
//! - Bytecode → Predecoded IR → Register IR → Native JIT (ARM64/x86_64)
//! - All Wasm 3.0 proposals, threads, SIMD, GC, exception handling supported
//! - Allocator-parameterized: caller controls memory allocation
//!
//! ## Examples
//! See practical examples in the repository:
//! - `examples/run_wasm.rs`
//! - `examples/host_imports.rs`
//! - `examples/memory_io.rs`
//! - `examples/wasi_config.rs`
//!
//! See the upstream [README](https://github.com/clojurewasm/zwasm) and [ARCHITECTURE.md](https://github.com/clojurewasm/zwasm/blob/main/ARCHITECTURE.md) for details.
pub use Config;
pub use ZwasmError;
pub use Imports;
pub use ;
pub use WasiConfig;