More progress :)
parent: tbd commit: 92c3f32
1 | use transmute; |
2 | |
3 | use ; |
4 | |
5 | use crate FFIBox; |
6 | |
7 | |
8 | |
9 | |
10 | operation_kind: *const u8, |
11 | operation_kind_len: usize, |
12 | pub serialize: unsafe extern "C" fn , |
13 | pub deserialize: unsafe extern "C" fn , |
14 | pub is_same: unsafe extern "C" fn , |
15 | pub serialize_success: unsafe extern "C" fn , |
16 | pub serialize_failure: unsafe extern "C" fn , |
17 | pub deserialize_success: unsafe extern "C" fn , |
18 | pub deserialize_failure: unsafe extern "C" fn , |
19 | |
20 | |
21 | |
22 | |
23 | let operation_kind = operation_kind .as_ptr; |
24 | let operation_kind_len = operation_kind .len; |
25 | |
26 | Self |
27 | serialize: serialize, |
28 | deserialize: deserialize, |
29 | is_same: is_same, |
30 | serialize_success: serialize_success, |
31 | serialize_failure: serialize_failure, |
32 | deserialize_success: deserialize_success, |
33 | deserialize_failure: deserialize_failure, |
34 | operation_kind, |
35 | operation_kind_len, |
36 | |
37 | |
38 | |
39 | |
40 | let slice = |
41 | unsafe ; |
42 | |
43 | unwrap | from_utf8 .
44 | |
45 | |
46 | |
47 | |
48 | |
49 | /// A pointer to the plugin-local object type. We are not capable of |
50 | /// knowing what this type is, we use the provided vtable. |
51 | inner: , |
52 | vtable: OperationVTable, |
53 | |
54 | |
55 | |
56 | |
57 | todo! |
58 | |
59 | |
60 | pub unsafe |
61 | Box from_raw |
62 | |
63 | |
64 | pub unsafe |
65 | let ptr: *const T = transmute; |
66 | |
67 | ptr.as_ref .unwrap |
68 | |
69 | |
70 | |
71 | self.vtable |
72 | |
73 | |
74 | |
75 | unsafe |
76 | from_utf8_unchecked |
77 | self.vtable.operation_kind, |
78 | self.vtable.operation_kind_len, |
79 | |
80 | |
81 | |
82 | |
83 | |
84 | todo! |
85 | |
86 | |
87 | |
88 | todo! |
89 | |
90 | |
91 | |
92 | todo! |
93 | |
94 | |
95 | |
96 | |
97 | |
98 | inner: , |
99 | vtable: OperationVTable, |
100 | |
101 | |
102 | |
103 | pub unsafe |
104 | self.inner.transmute_ref |
105 | |
106 | |
107 | pub unsafe |
108 | Self |
109 | |
110 | |
111 | |
112 | todo! |
113 | |
114 | |
115 | |
116 | _source: &[u8], |
117 | _vtable: OperationVTable, |
118 | |
119 | todo! |
120 | |
121 | |
122 | |
123 | unsafe |
124 | unsafe |
125 | |
126 | |
127 | |
128 | f.debug_struct .finish |
129 | |
130 | |
131 | |
132 | |
133 | |
134 | inner: , |
135 | vtable: OperationVTable, |
136 | |
137 | |
138 | unsafe |
139 | unsafe |
140 | |
141 | |
142 | |
143 | f.debug_struct .finish |
144 | |
145 | |
146 | |
147 | |
148 | ; |
149 | unsafe extern "C" ; |
150 | unsafe extern "C" ; |
151 | unsafe extern "C" ; |
152 | unsafe extern "C" ; |
153 | unsafe extern "C" ; |
154 | unsafe extern "C" ; |
155 | unsafe extern "C" ; |
156 | |
157 | |
158 | |
159 | |
160 | D: , |
161 | O: GiteratedObject, |
162 | |
163 | unsafe extern "C" |
164 | todo! |
165 | |
166 | |
167 | unsafe extern "C" |
168 | let deserialized: D = from_slice .unwrap; |
169 | |
170 | Ok |
171 | inner: from_box .untyped, |
172 | vtable: , |
173 | |
174 | |
175 | |
176 | unsafe extern "C" |
177 | todo! |
178 | |
179 | |
180 | unsafe extern "C" |
181 | todo! |
182 | |
183 | |
184 | unsafe extern "C" |
185 | todo! |
186 | |
187 | |
188 | unsafe extern "C" |
189 | todo! |
190 | |
191 | |
192 | unsafe extern "C" |
193 | todo! |
194 | |
195 | |
196 | |
197 | <D as > operation_name |
198 | |
199 | |
200 |