mod operation; use giterated_models::{ error::OperationError, object::{GiteratedObject, Object, ObjectRequestError}, object_backend::ObjectBackend, operation::{GiteratedOperation, OperationState}, }; use std::fmt::Debug; pub use operation::*; mod value; pub use value::*; mod setting; pub use setting::*; use crate::{vtable::RuntimeVTable, AnyObject, AnyOperation}; /// A container for a callback pointer, used to provide an internal callback function or /// state to a plugin when performing a callback. #[derive(Clone, Copy)] #[repr(C)] pub struct CallbackPtr(*const ()); impl CallbackPtr { pub unsafe fn from_raw(callback: *const ()) -> Self { Self(callback) } } #[derive(Clone)] #[repr(C)] pub struct RuntimeState { pub vtable: RuntimeVTable, pub operation_state: OperationState, } impl RuntimeState { pub unsafe fn from_static() -> Self { let runtime = giterated_static_runtime::get_runtime_reference(); let runtime = runtime.cast::>().as_ref(); *runtime.clone() } } #[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> { todo!() } }