use giterated_models::{error::OperationError, object::ObjectRequestError}; use crate::{ result::{FfiError, FfiResult}, state::State, value_ex::FfiValueUntyped, FfiFuture, FfiSliceRef, FfiValueMut, }; use super::{Object, ObjectABI}; pub struct RuntimeHandle; impl ObjectABI for RuntimeHandle { type VTable = RuntimeVTable; } #[derive(Clone, Copy)] pub struct RuntimeVTable { pub(crate) handle_fn: unsafe extern "C" fn( FfiSliceRef, FfiSliceRef, FfiSliceRef, FfiSliceRef<[u8]>, FfiSliceRef<[u8]>, ) -> FfiFuture< FfiResult>, >, pub(crate) get_object: unsafe extern "C" fn( &str, state: FfiValueMut, ) -> FfiResult>, } unsafe impl Send for RuntimeVTable {} unsafe impl Sync for RuntimeVTable {} pub trait IntoRuntimeVtable { unsafe extern "C" fn handle( object_kind: FfiSliceRef, operation_name: FfiSliceRef, object: FfiSliceRef, operation_payload: FfiSliceRef<[u8]>, operation_state: FfiSliceRef<[u8]>, ) -> FfiFuture>>; unsafe extern "C" fn get_object( object_str: &str, operation_state: FfiValueMut, ) -> FfiResult>; }