use giterated_models::{ error::OperationError, object::ObjectRequestError, operation::OperationState, }; use crate::{ future::RuntimeFuture, new_stack::{PluginState, TypeMetadata}, AnyFailure, AnyObject, AnySuccess, FFIBox, }; #[derive(Clone, Copy)] pub struct RuntimeVTable { pub(crate) runtime: PluginState, pub(crate) type_metadata: *const TypeMetadata, pub(crate) handle_fn: unsafe extern "C" fn( PluginState, FFIBox, FFIBox, FFIBox, FFIBox<[u8]>, FFIBox<[u8]>, ) -> RuntimeFuture< Result>, >, pub(crate) get_object: unsafe extern "C" fn( PluginState, &str, *mut OperationState, ) -> Result>, } unsafe impl Send for RuntimeVTable {} unsafe impl Sync for RuntimeVTable {} pub trait IntoRuntimeVtable { unsafe extern "C" fn handle( this: PluginState, object_kind: FFIBox, operation_name: FFIBox, object: FFIBox, operation_payload: FFIBox<[u8]>, operation_state: FFIBox<[u8]>, ) -> RuntimeFuture>>; unsafe extern "C" fn get_object( this: PluginState, object_str: &str, operation_state: *mut OperationState, ) -> Result>; }