Huge refactor to prep for moving the daemon over to the plugin architecture
parent: tbd commit: 5df753c
1 | use transmute; |
2 | |
3 | use ; |
4 | |
5 | use crate FFIBox; |
6 | |
7 | use AnyObject; |
8 | |
9 | |
10 | |
11 | |
12 | operation_kind: *const u8, |
13 | operation_kind_len: usize, |
14 | pub serialize: unsafe extern "C" fn , |
15 | pub deserialize: unsafe extern "C" fn , |
16 | pub is_same: unsafe extern "C" fn , |
17 | pub serialize_success: unsafe extern "C" fn , |
18 | pub serialize_failure: unsafe extern "C" fn , |
19 | pub deserialize_success: unsafe extern "C" fn , |
20 | pub deserialize_failure: unsafe extern "C" fn , |
21 | |
22 | |
23 | |
24 | |
25 | let operation_kind = operation_kind .as_ptr; |
26 | let operation_kind_len = operation_kind .len; |
27 | |
28 | Self |
29 | serialize: serialize, |
30 | deserialize: deserialize, |
31 | is_same: is_same, |
32 | serialize_success: serialize_success, |
33 | serialize_failure: serialize_failure, |
34 | deserialize_success: deserialize_success, |
35 | deserialize_failure: deserialize_failure, |
36 | operation_kind, |
37 | operation_kind_len, |
38 | |
39 | |
40 | |
41 | |
42 | let slice = |
43 | unsafe ; |
44 | |
45 | unwrap | from_utf8 .
46 | |
47 | |
48 | |
49 | |
50 | /// A pointer to the plugin-local object type. We are not capable of |
51 | /// knowing what this type is, we use the provided vtable. |
52 | inner: , |
53 | vtable: OperationVTable, |
54 | |
55 | |
56 | |
57 | pub unsafe |
58 | Box from_raw |
59 | |
60 | |
61 | pub unsafe |
62 | let ptr: *const T = transmute; |
63 | |
64 | ptr.as_ref .unwrap |
65 | |
66 | |
67 | |
68 | self.vtable |
69 | |
70 | |
71 | |
72 | |
73 | |
74 | inner: , |
75 | vtable: OperationVTable, |
76 | |
77 | |
78 | |
79 | |
80 | inner: , |
81 | vtable: OperationVTable, |
82 | |
83 | |
84 | |
85 | ; |
86 | unsafe extern "C" ; |
87 | unsafe extern "C" ; |
88 | unsafe extern "C" ; |
89 | unsafe extern "C" ; |
90 | unsafe extern "C" ; |
91 | unsafe extern "C" ; |
92 | unsafe extern "C" ; |
93 | |
94 | |
95 | |
96 | |
97 | D: , |
98 | O: GiteratedObject, |
99 | |
100 | unsafe extern "C" |
101 | todo! |
102 | |
103 | |
104 | unsafe extern "C" |
105 | let deserialized: D = from_slice .unwrap; |
106 | |
107 | Ok |
108 | inner: from_box .untyped, |
109 | vtable: , |
110 | |
111 | |
112 | |
113 | unsafe extern "C" |
114 | todo! |
115 | |
116 | |
117 | unsafe extern "C" |
118 | todo! |
119 | |
120 | |
121 | unsafe extern "C" |
122 | todo! |
123 | |
124 | |
125 | unsafe extern "C" |
126 | todo! |
127 | |
128 | |
129 | unsafe extern "C" |
130 | todo! |
131 | |
132 | |
133 | |
134 | todo! |
135 | |
136 | |
137 |