Skip to main content

uni_plugin_wasm_rt/
lib.rs

1//! Shared runtime helpers for the uni-db WASM plugin loaders.
2//!
3//! `uni-plugin-wasm-rt` is the M6.shared lift — a crate that sits below
4//! both `uni-plugin-extism` and `uni-plugin-wasm` in the dependency
5//! graph and owns the two pieces of machinery they would otherwise
6//! duplicate:
7//!
8//! - **Arrow IPC bridge** ([`ipc`]) — `RecordBatch` ↔ stream bytes,
9//!   shared between Extism's bytes-in/bytes-out boundary and the
10//!   Component Model's linear-memory boundary.
11//! - **Per-plugin instance cache** ([`pool`]) — generic over the
12//!   per-invoke instance type and the loader's error type. Both loaders
13//!   alias this with their concrete `T` and error. It builds a fresh
14//!   instance per acquire (so guest state can't leak across calls) and
15//!   enforces a concurrency cap.
16//!
17//! Neither piece depends on extism or wasmtime; both depend only on
18//! `arrow-ipc` and `parking_lot`. That keeps the
19//! crate small and lets it stay below `uni-plugin` in the workspace
20//! dep graph, so the trait-only embedder pays nothing for plumbing
21//! they never invoke.
22
23// Rust guideline compliant
24#![warn(missing_docs)]
25#![warn(rust_2018_idioms)]
26#![warn(missing_debug_implementations)]
27
28pub mod error;
29pub mod ipc;
30pub mod pool;
31
32#[doc(inline)]
33pub use error::IpcError;
34#[doc(inline)]
35pub use ipc::{decode_batch, decode_batches, encode_batch, encode_batches};
36#[doc(inline)]
37pub use pool::{InstancePool, PoolConfig, PoolMetrics, PooledInstance};