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