#[repr(C)]pub struct LanguageRuntimeVTable {
pub init: Option<unsafe extern "C" fn(config: *const u8, config_len: usize) -> *mut c_void>,
pub register_types: Option<unsafe extern "C" fn(instance: *mut c_void, types: *const u8, types_len: usize) -> i32>,
pub compile: Option<unsafe extern "C" fn(instance: *mut c_void, name: *const u8, name_len: usize, source: *const u8, source_len: usize, param_names: *const u8, param_names_len: usize, param_types: *const u8, param_types_len: usize, return_type: *const u8, return_type_len: usize, is_async: bool, out_error: *mut *mut u8, out_error_len: *mut usize) -> *mut c_void>,
pub invoke: Option<unsafe extern "C" fn(instance: *mut c_void, handle: *mut c_void, args: *const u8, args_len: usize, out_ptr: *mut *mut u8, out_len: *mut usize) -> i32>,
pub dispose_function: Option<unsafe extern "C" fn(instance: *mut c_void, handle: *mut c_void)>,
pub language_id: Option<unsafe extern "C" fn(instance: *mut c_void) -> *const c_char>,
pub get_lsp_config: Option<unsafe extern "C" fn(instance: *mut c_void, out_ptr: *mut *mut u8, out_len: *mut usize) -> i32>,
pub free_buffer: Option<unsafe extern "C" fn(ptr: *mut u8, len: usize)>,
pub drop: Option<unsafe extern "C" fn(instance: *mut c_void)>,
pub error_model: ErrorModel,
}Expand description
VTable for language runtime plugins (Python, Julia, SQL, etc.).
Language runtimes enable fn <language> name(...) { body } blocks in Shape.
The runtime compiles and invokes foreign language code, providing type
marshaling between Shape values and native language objects.
Fields§
§init: Option<unsafe extern "C" fn(config: *const u8, config_len: usize) -> *mut c_void>Initialize the runtime with MessagePack-encoded config. Returns: opaque instance pointer, or null on error.
register_types: Option<unsafe extern "C" fn(instance: *mut c_void, types: *const u8, types_len: usize) -> i32>Register Shape type schemas for stub generation (e.g. .pyi files).
types_msgpack: MessagePack-encoded Vec<TypeSchemaExport>.
Returns: 0 on success.
compile: Option<unsafe extern "C" fn(instance: *mut c_void, name: *const u8, name_len: usize, source: *const u8, source_len: usize, param_names: *const u8, param_names_len: usize, param_types: *const u8, param_types_len: usize, return_type: *const u8, return_type_len: usize, is_async: bool, out_error: *mut *mut u8, out_error_len: *mut usize) -> *mut c_void>Pre-compile a foreign function body.
name: function name (UTF-8)source: dedented body text (UTF-8)param_names_msgpack: MessagePackVec<String>of parameter namesparam_types_msgpack: MessagePackVec<String>of Shape type namesreturn_type: Shape return type name (UTF-8, empty if none)is_async: whether the function was declaredasyncin Shape
Returns: opaque compiled function handle, or null on error.
On error, writes a UTF-8 error message to out_error / out_error_len
(caller frees via free_buffer).
invoke: Option<unsafe extern "C" fn(instance: *mut c_void, handle: *mut c_void, args: *const u8, args_len: usize, out_ptr: *mut *mut u8, out_len: *mut usize) -> i32>Invoke a compiled function with MessagePack-encoded arguments.
args_msgpack: MessagePack-encoded argument array.
On success, writes MessagePack-encoded result to out_ptr / out_len.
Returns: 0 on success, non-zero on error.
dispose_function: Option<unsafe extern "C" fn(instance: *mut c_void, handle: *mut c_void)>Release a compiled function handle.
language_id: Option<unsafe extern "C" fn(instance: *mut c_void) -> *const c_char>Return the language identifier (null-terminated C string, e.g. “python”). The returned pointer must remain valid for the lifetime of the instance.
get_lsp_config: Option<unsafe extern "C" fn(instance: *mut c_void, out_ptr: *mut *mut u8, out_len: *mut usize) -> i32>Return MessagePack-encoded LanguageRuntimeLspConfig.
Caller frees via free_buffer.
free_buffer: Option<unsafe extern "C" fn(ptr: *mut u8, len: usize)>Free a buffer allocated by compile/invoke/get_lsp_config.
drop: Option<unsafe extern "C" fn(instance: *mut c_void)>Cleanup and destroy the runtime instance.
error_model: ErrorModelError model for this language runtime.
Dynamic (0) means every call can fail at runtime — return values are
automatically wrapped in Result<T>. Static (1) means the language
has compile-time type safety and runtime errors are not expected.
Defaults to Dynamic (0) when zero-initialized.