JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

More restructuring

Amber - ⁨1⁩ year ago

parent: tbd commit: ⁨10b7b7c

⁨giterated-core/src/lib.rs⁩ - ⁨2018⁩ bytes
Raw
1 use giterated_abi::vtable::{runtime::RuntimeHandle, VTable};
2
3 pub mod state;
4 pub mod types;
5
6 #[derive(Clone)]
7 #[repr(C)]
8 pub struct RuntimeState {
9 pub vtable: &'static VTable<RuntimeHandle>,
10 }
11
12 // impl RuntimeState {
13 // pub unsafe fn from_static() -> Self {
14 // let runtime = giterated_static_runtime::get_runtime_reference();
15
16 // let runtime = runtime.cast::<Box<Runtime>>().as_ref();
17
18 // runtime.state()
19 // }
20
21 // pub unsafe fn runtime_state() -> PluginState {
22 // let runtime = giterated_static_runtime::get_runtime_reference();
23
24 // PluginState::from_raw_ptr(giterated_static_runtime::get_runtime_reference().as_ptr())
25 // }
26 // }
27
28 // #[async_trait::async_trait(?Send)]
29 // impl ObjectBackend for RuntimeState {
30 // async fn object_operation<O, D>(
31 // &self,
32 // object: O,
33 // _operation: &str,
34 // payload: D,
35 // _operation_state: &OperationState,
36 // ) -> Result<D::Success, OperationError<D::Failure>>
37 // where
38 // O: GiteratedObject + Debug + 'static,
39 // D: GiteratedOperation<O> + Debug + 'static,
40 // D::Success: Clone,
41 // D::Failure: Clone,
42 // {
43 // // let _object = AnyObject::new(object);
44 // // let _operation = AnyOperation::new(payload);
45
46 // todo!()
47 // }
48
49 // async fn get_object<O: GiteratedObject + Debug + 'static>(
50 // &self,
51 // object_str: &str,
52 // operation_state: &OperationState,
53 // ) -> Result<Object<O, Self>, OperationError<ObjectRequestError>> {
54 // // let object = unsafe {
55 // // (self.vtable.get_object)(
56 // // Self::runtime_state(),
57 // // object_str,
58 // // &mut operation_state.clone(),
59 // // )
60 // // }?;
61
62 // // let object = unsafe { object.cast::<O>() };
63
64 // panic!("object casted");
65
66 // // Ok(unsafe { Object::new_unchecked(object, self.clone()) })
67
68 // todo!()
69 // }
70 // }
71