surrealism-types
Shared types for the Surrealism WASM plugin system in SurrealDB.
Overview
surrealism-types provides the common types used by both the guest SDK (surrealism) and the host runtime (surrealism-runtime):
Argstrait (args.rs) — Typed argument marshalling between Rust tuples andsurrealdb_types::Valuevectors. Implemented for tuples of 0–10 elements andVec<T>.SurrealismError(err.rs) — Unified error type covering compilation, instantiation, ABI mismatches, and runtime errors.PrefixErrtrait (err.rs) — Extension trait for adding context to errors (similar to anyhow'sContext).
Usage
Function Arguments
use Args;
// Convert typed arguments to Values
let args = ;
let values = args.to_values;
// Reconstruct typed arguments from Values
let restored: = from_values.unwrap;
Feature Flags
host
Enable for host-side (runtime) code:
[]
= { = "*", = ["host"] }
When enabled, adds Wasmtime error variants to SurrealismError.
Related Crates
- surrealism-runtime — Host-side WASM runtime implementation
- surrealism — Guest SDK for building WASM modules
- surrealism-macros — Procedural macros for the
#[surrealism]attribute - surrealdb-types — Core SurrealDB type system