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

ambee/giterated

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

insanity

Amber - ⁨1⁩ year ago

parent: tbd commit: ⁨6ea28ab

⁨giterated-abi/src/model_impl/mod.rs⁩ - ⁨2519⁩ bytes
Raw
1 use std::ffi::CStr;
2
3 use giterated_models::{object::GiteratedObject, operation::GiteratedOperation};
4
5 use crate::{
6 result::{FfiError, FfiResult},
7 value_ex::{FfiValueRefUntyped, FfiValueUntyped},
8 vtable::{
9 operation::{IntoOperationVTable, Operation},
10 IntoObjectVTable, IntoSettingVTable, IntoValueVTable, Object, Setting,
11 },
12 FfiSlice, FfiSliceRef, FfiValueRef,
13 };
14
15 impl<T> IntoObjectVTable for T
16 where
17 T: GiteratedObject,
18 {
19 fn object_kind() -> &'static CStr {
20 todo!()
21 }
22
23 unsafe extern "C" fn to_str(this: FfiValueRef<Object>) -> FfiSlice<str> {
24 todo!()
25 }
26
27 unsafe extern "C" fn from_str(from: FfiSliceRef<str>) -> FfiResult<Object, FfiError> {
28 todo!()
29 }
30
31 unsafe extern "C" fn home_uri(this: FfiValueRef<Object>) -> FfiSlice<str> {
32 todo!()
33 }
34 }
35
36 impl<T, O> IntoOperationVTable<O> for T
37 where
38 T: GiteratedOperation<O>,
39 O: GiteratedObject,
40 {
41 fn operation_kind() -> &'static CStr {
42 todo!()
43 }
44
45 unsafe extern "C" fn operation_serialize(
46 this: FfiValueRef<Operation>,
47 ) -> FfiResult<FfiSlice<[u8]>, FfiError> {
48 todo!()
49 }
50
51 unsafe extern "C" fn operation_deserialize(
52 buffer: FfiSliceRef<[u8]>,
53 ) -> FfiResult<Operation, FfiError> {
54 todo!()
55 }
56
57 unsafe extern "C" fn success_serialize(
58 success: FfiValueRefUntyped,
59 ) -> FfiResult<FfiSlice<[u8]>, FfiError> {
60 todo!()
61 }
62
63 unsafe extern "C" fn success_deserialize(
64 buffer: FfiSliceRef<[u8]>,
65 ) -> FfiResult<FfiValueUntyped, FfiError> {
66 todo!()
67 }
68
69 unsafe extern "C" fn failure_serialize(
70 failure: FfiValueRefUntyped,
71 ) -> FfiResult<FfiSlice<[u8]>, FfiError> {
72 todo!()
73 }
74
75 unsafe extern "C" fn failure_deserialize(
76 buffer: FfiSliceRef<[u8]>,
77 ) -> FfiResult<FfiValueUntyped, FfiError> {
78 todo!()
79 }
80 }
81
82 impl<T> IntoValueVTable for T {
83 unsafe extern "C" fn serialize(
84 buffer: FfiSliceRef<[u8]>,
85 ) -> FfiResult<crate::vtable::Value, FfiError> {
86 todo!()
87 }
88
89 unsafe extern "C" fn deserialize(
90 this: crate::vtable::Value,
91 ) -> FfiResult<FfiSlice<[u8]>, FfiError> {
92 todo!()
93 }
94 }
95
96 impl<T> IntoSettingVTable for T {
97 unsafe extern "C" fn serialize(this: Setting) -> FfiResult<FfiSlice<[u8]>, FfiError> {
98 todo!()
99 }
100
101 unsafe extern "C" fn deserialize(buffer: FfiSliceRef<[u8]>) -> FfiResult<Setting, FfiError> {
102 todo!()
103 }
104 }
105