More progress :)
parent: tbd commit: 92c3f32
1 | use Future; |
2 | |
3 | use |
4 | , GiteratedObject, GiteratedObjectValue, | OperationError
5 | ; |
6 | |
7 | use crate:: |
8 | , |
9 | , | PluginState
10 | , |
11 | ; |
12 | |
13 | use ; |
14 | |
15 | |
16 | |
17 | pub callback_ptr: CallbackPtr, |
18 | pub func: unsafe extern "C" fn |
19 | CallbackPtr, |
20 | runtime_state: &RuntimeState, |
21 | &PluginState, |
22 | object: AnyObject, |
23 | , |
24 | |
25 | |
26 | |
27 | |
28 | Self |
29 | func: get_value, |
30 | callback_ptr: handler.callback_ptr, |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | unsafe extern "C" |
37 | callback: CallbackPtr, |
38 | runtime_state: &RuntimeState, |
39 | state: &PluginState, |
40 | object: AnyObject, |
41 | ; |
42 | |
43 | ; |
44 | |
45 | |
46 | |
47 | |
48 | Fut: + Send + Sync, |
49 | S: Clone + Send + Sync + 'static, |
50 | O: GiteratedObject + 'static, |
51 | V: + Send + Sync + 'static, |
52 | F: Fn(S, O) -> Fut + Send + Sync + 'static, |
53 | |
54 | unsafe extern "C" |
55 | callback: CallbackPtr, |
56 | runtime_state: &RuntimeState, |
57 | state: &PluginState, |
58 | mut object: AnyObject, |
59 | |
60 | let _guard = trace_span! |
61 | "get_value handler", |
62 | object = object_name, |
63 | value = value_name |
64 | |
65 | .entered; |
66 | let state = unsafe ; |
67 | |
68 | let object = unsafe ; |
69 | |
70 | // Cast the callback ptr to ourselves |
71 | let callback: *const F = transmute; |
72 | let callback = callback.as_ref .unwrap; |
73 | |
74 | let state = state.clone; |
75 | runtime_state.spawn_future |
76 | let result = callback .await; |
77 | |
78 | match result |
79 | Ok => unsafe , |
80 | Err => match err |
81 | => todo!, | Operation
82 | => todo!, | Internal
83 | => todo!, | Unhandled
84 | , |
85 | |
86 | |
87 | |
88 | |
89 | |
90 | unsafe |
91 | |
92 | |
93 | |
94 | |
95 | func: unsafe extern "C" fn |
96 | &PluginState, |
97 | object: AnyObject, |
98 | value_name: &str, |
99 | new_value: NewAnyValue, |
100 | , |
101 | |
102 | |
103 | |
104 | unsafe extern "C" |
105 | state: &PluginState, |
106 | object: AnyObject, |
107 | value_name: &str, |
108 | new_value: NewAnyValue, |
109 | ; |
110 | |
111 | |
112 | |
113 | unsafe extern "C" |
114 | _state: &PluginState, |
115 | _object: AnyObject, |
116 | _value_name: &str, |
117 | _new_value: NewAnyValue, |
118 | |
119 | todo! |
120 | |
121 | |
122 | |
123 | |
124 | |
125 | Self |
126 | func: value_changed, |
127 | |
128 | |
129 | |
130 |