Before
parent: tbd commit: e432306
1 | |
2 | |
3 | use |
4 | , |
5 | , | FfiError
6 | , | FfiValueUntyped
7 | |
8 | , |
9 | IntoObjectVTable, IntoSettingVTable, IntoValueVTable, Object, ObjectVTable, SettingVTable, |
10 | VTable, ValueVTable, |
11 | , |
12 | FfiValueRef, |
13 | ; |
14 | use |
15 | , GiteratedOperation, Setting, | GiteratedObject
16 | , | GiteratedObjectValue
17 | ; |
18 | use |
19 | |
20 | IntoPluginOperationHandler, IntoPluginSettingGetter, IntoPluginSettingSetter, |
21 | IntoPluginValueGetter, OperationHandlerCallback, SettingGetterCallback, |
22 | ValueGetterCallback, |
23 | , |
24 | , | PluginInitializationState
25 | , | PluginState
26 | , | Initialization
27 | ; |
28 | use trace_span; |
29 | |
30 | |
31 | init_state: *mut PluginInitializationState, |
32 | vtable: &'static , |
33 | state: S, |
34 | |
35 | |
36 | |
37 | |
38 | plugin_state: S, |
39 | state: *mut PluginInitializationState, |
40 | vtable: &'static , |
41 | |
42 | PluginStackBuilder |
43 | init_state: state, |
44 | vtable, |
45 | state: plugin_state, |
46 | |
47 | |
48 | |
49 | |
50 | let _guard = trace_span! .entered; |
51 | |
52 | let func = self.vtable.register_object; |
53 | |
54 | unsafe |
55 | func |
56 | self.init_state, |
57 | , | object_name
58 | VTABLE |
59 | |
60 | ; |
61 | |
62 | self |
63 | |
64 | |
65 | |
66 | |
67 | D: + , |
68 | O: GiteratedObject, |
69 | |
70 | let _guard = trace_span! .entered; |
71 | |
72 | unsafe |
73 | |
74 | self.init_state, |
75 | , | object_name
76 | , | operation_name
77 | VTABLE, |
78 | |
79 | |
80 | |
81 | self |
82 | |
83 | |
84 | |
85 | |
86 | O: GiteratedObject, |
87 | OS: IntoSettingVTable + Setting, |
88 | HG: , |
89 | HS: , |
90 | |
91 | let _guard = trace_span! .entered; |
92 | |
93 | unsafe |
94 | |
95 | self.init_state, |
96 | , | object_name
97 | OS name, |
98 | OSVTABLE, |
99 | |
100 | |
101 | |
102 | self |
103 | |
104 | |
105 | |
106 | |
107 | O: GiteratedObject, |
108 | OS: IntoSettingVTable + Setting, |
109 | |
110 | let _guard = trace_span! .entered; |
111 | |
112 | unsafe |
113 | |
114 | self.init_state, |
115 | , | object_name
116 | OS name, |
117 | OSVTABLE, |
118 | |
119 | |
120 | |
121 | self |
122 | |
123 | |
124 | |
125 | |
126 | O: GiteratedObject, |
127 | V: IntoValueVTable + , |
128 | T: , |
129 | |
130 | let _guard = trace_span! .entered; |
131 | |
132 | unsafe |
133 | |
134 | self.init_state, |
135 | , | object_name
136 | , | value_name
137 | VTABLE, |
138 | |
139 | |
140 | |
141 | // unsafe { |
142 | // (self.vtable.value_getter)( |
143 | // self.init_state, |
144 | // O::object_name(), |
145 | // V::value_name(), |
146 | // ValueGetterCallback::new::<S, O, V, T>(handler), |
147 | // ) |
148 | // } |
149 | |
150 | self |
151 | |
152 | |
153 | |
154 | A, |
155 | O: GiteratedObject + IntoObjectVTable, |
156 | D: + , |
157 | T: , |
158 | > |
159 | &mut self, |
160 | handler: T, |
161 | |
162 | let _guard = trace_span! .entered; |
163 | |
164 | // unsafe { |
165 | // (self.vtable.operation_handler)( |
166 | // self.init_state, |
167 | // O::object_name(), |
168 | // D::operation_name(), |
169 | // OperationHandlerCallback::new::<S, O, D, A, T>(handler), |
170 | // ) |
171 | // } |
172 | |
173 | // TODO: Yikes? |
174 | self.; |
175 | |
176 | self.; |
177 | |
178 | self |
179 | |
180 | |
181 | // pub fn value_getter<O, V, T>(&mut self, handler: T) -> &mut Self |
182 | // where |
183 | // O: GiteratedObject + IntoObjectVTable, |
184 | // V: GiteratedObjectValue<Object = O> + IntoValueVTable<O>, |
185 | // T: IntoPluginValueGetter<S, O, V>, |
186 | // { |
187 | // let _guard = trace_span!("register value_getter handler").entered(); |
188 | |
189 | // unsafe { |
190 | // (self.vtable.value_getter)( |
191 | // self.init_state, |
192 | // O::object_name(), |
193 | // V::value_name(), |
194 | // ValueGetterCallback::new::<S, O, V, T>(handler), |
195 | // ) |
196 | // } |
197 | |
198 | // // TODO: Yikes? |
199 | // self.object::<O>(); |
200 | // self.value::<O, V>(); |
201 | |
202 | // self |
203 | // } |
204 | |
205 | |
206 | |
207 | O: GiteratedObject + IntoObjectVTable, |
208 | OS: Setting + IntoSettingVTable, |
209 | T: , |
210 | |
211 | let _guard = trace_span! .entered; |
212 | |
213 | // unsafe { |
214 | // (self.vtable.setting_getter)( |
215 | // self.init_state, |
216 | // O::object_name(), |
217 | // OS::name(), |
218 | // SettingGetterCallback::new::<S, O, OS, T>(handler), |
219 | // ) |
220 | // } |
221 | |
222 | self.; |
223 | |
224 | unsafe |
225 | |
226 | self.init_state, |
227 | , | object_name
228 | OS name, |
229 | OSVTABLE, |
230 | |
231 | ; |
232 | |
233 | self |
234 | |
235 | |
236 | |
237 | |
238 | |
239 | |
240 | O: GiteratedObject + IntoObjectVTable + 'static, |
241 | VS: + IntoValueVTable + Setting + IntoSettingVTable, |
242 | HG: , |
243 | HS: ; |
244 | } |
245 | |
246 | for |
247 | |
248 | |
249 | O: GiteratedObject + IntoObjectVTable + 'static, |
250 | VS: + IntoValueVTable + Setting + IntoSettingVTable, |
251 | HG: , |
252 | HS: , |
253 | |
254 | self |
255 | |
256 | |
257 | |
258 | |
259 | ; |
260 | |
261 | |
262 | type CallbackFunc = unsafe extern "C" fn |
263 | callback: , |
264 | state: &PluginState, |
265 | object: , |
266 | ; |
267 | |
268 | |
269 | |
270 | unsafe extern "C" |
271 | callback: , |
272 | state: &PluginState, |
273 | object: , |
274 | ; |
275 | |
276 | ; |
277 | |
278 | |
279 | |
280 | |
281 | O: GiteratedObject, |
282 | VS: , |
283 | HG: , |
284 | |
285 | unsafe extern "C" |
286 | _callback: , |
287 | _state: &PluginState, |
288 | _object: , |
289 | |
290 | // let result = HG::get_setting(callback, state, object)?; |
291 | |
292 | // let setting = *result.transmute_owned::<VS>(); |
293 | |
294 | todo!; |
295 | |
296 | // Ok(NewAnyValue::new(setting)) |
297 | |
298 | |
299 | |
300 | todo! |
301 | |
302 | |
303 |