surrealism/types/README.md
Shared types for the Surrealism WASM plugin system in SurrealDB.
surrealism-types provides the common types used by both the guest SDK (surrealism) and the host runtime (surrealism-runtime):
Args trait (args.rs) — Typed argument marshalling between Rust tuples and surrealdb_types::Value vectors. Implemented for tuples of 0–10 elements and Vec<T>.SurrealismError (err.rs) — Unified error type covering compilation, instantiation, ABI mismatches, and runtime errors.PrefixErr trait (err.rs) — Extension trait for adding context to errors (similar to anyhow's Context).use surrealism_types::args::Args;
// Convert typed arguments to Values
let args = ("hello".to_string(), 42i64);
let values = args.to_values();
// Reconstruct typed arguments from Values
let restored: (String, i64) = Args::from_values(values).unwrap();
hostEnable for host-side (runtime) code:
[dependencies]
surrealism-types = { version = "*", features = ["host"] }
When enabled, adds Wasmtime error variants to SurrealismError.
#[surrealism] attribute