use giterated_abi::vtable::{runtime::RuntimeHandle, VTable}; pub mod state; pub mod types; #[derive(Clone)] #[repr(C)] pub struct RuntimeState { pub vtable: &'static VTable, } // impl RuntimeState { // pub unsafe fn from_static() -> Self { // let runtime = giterated_static_runtime::get_runtime_reference(); // let runtime = runtime.cast::>().as_ref(); // runtime.state() // } // pub unsafe fn runtime_state() -> PluginState { // let runtime = giterated_static_runtime::get_runtime_reference(); // PluginState::from_raw_ptr(giterated_static_runtime::get_runtime_reference().as_ptr()) // } // } // #[async_trait::async_trait(?Send)] // impl ObjectBackend for RuntimeState { // async fn object_operation( // &self, // object: O, // _operation: &str, // payload: D, // _operation_state: &OperationState, // ) -> Result> // where // O: GiteratedObject + Debug + 'static, // D: GiteratedOperation + Debug + 'static, // D::Success: Clone, // D::Failure: Clone, // { // // let _object = AnyObject::new(object); // // let _operation = AnyOperation::new(payload); // todo!() // } // async fn get_object( // &self, // object_str: &str, // operation_state: &OperationState, // ) -> Result, OperationError> { // // let object = unsafe { // // (self.vtable.get_object)( // // Self::runtime_state(), // // object_str, // // &mut operation_state.clone(), // // ) // // }?; // // let object = unsafe { object.cast::() }; // panic!("object casted"); // // Ok(unsafe { Object::new_unchecked(object, self.clone()) }) // todo!() // } // }