Structure refactoring
parent: tbd commit: a8f41ac
1 | ; |
2 | |
3 | |
4 | type CallbackFunc = unsafe extern "C" fn |
5 | , |
6 | state: , |
7 | object: , |
8 | ; |
9 | |
10 | |
11 | |
12 | unsafe extern "C" |
13 | callback_ptr: , |
14 | state: , |
15 | object: , |
16 | ; |
17 | |
18 | |
19 | // unsafe { CallbackPtr::from_raw(self as *const _ as *const ()) } |
20 | todo! |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | Fut: + Send + Sync + 'static, |
27 | S: Clone + Send + Sync + 'static, |
28 | O: GiteratedObject + Send + Sync + 'static, |
29 | OS: Setting + Send + Sync + 'static, |
30 | F: Fn(S, O) -> Fut + Send + Sync + 'static, |
31 | |
32 | unsafe extern "C" |
33 | callback: , |
34 | state: , |
35 | mut object: , |
36 | |
37 | // let _guard = trace_span!( |
38 | // "get_setting handler", |
39 | // object = O::object_name(), |
40 | // setting = OS::name() |
41 | // ) |
42 | // .entered(); |
43 | // let state = unsafe { state.transmute_ref::<S>() }; |
44 | |
45 | // let object = unsafe { object.transmute_owned::<O>() }; |
46 | |
47 | // // Cast the callback ptr to ourselves |
48 | // let callback: *const F = std::mem::transmute(callback.0); |
49 | // let callback = callback.as_ref().unwrap(); |
50 | |
51 | // let state = state.clone(); |
52 | // runtime_state.spawn_future(async move { |
53 | // let result = callback(state, *object).await; |
54 | |
55 | // match result { |
56 | // Ok(success) => unsafe { Ok(NewAnySetting::new(success)) }, |
57 | // Err(err) => match err { |
58 | // OperationError::Operation(_) => todo!(), |
59 | // OperationError::Internal(_) => todo!(), |
60 | // OperationError::Unhandled => todo!(), |
61 | // }, |
62 | // } |
63 | |
64 | todo! |
65 | // }) |
66 | |
67 | |
68 | |
69 | |
70 | unsafe extern "C" |
71 | callback_ptr: , |
72 | state: &PluginState, |
73 | object: , |
74 | setting: Setting, |
75 | ; |
76 | |
77 | |
78 | // unsafe { CallbackPtr::from_raw(self as *const _ as *const ()) } |
79 | todo! |
80 | |
81 | |
82 | |
83 | |
84 | |
85 | Fut: , |
86 | S: Clone, |
87 | O: GiteratedObject, |
88 | OS: Setting, |
89 | F: Fn(S, O, OS) -> Fut, |
90 | |
91 | unsafe extern "C" |
92 | callback: , |
93 | state: &PluginState, |
94 | mut object: , |
95 | _setting: Setting, |
96 | |
97 | // let _guard = trace_span!( |
98 | // "get_setting handler", |
99 | // object = O::object_name(), |
100 | // setting = OS::name() |
101 | // ) |
102 | // .entered(); |
103 | // let _state = unsafe { state.transmute_ref::<S>() }; |
104 | |
105 | // let _object = unsafe { object.transmute_owned::<O>() }; |
106 | |
107 | // // Cast the callback ptr to ourselves |
108 | // let callback: *const F = std::mem::transmute(callback.0); |
109 | // let _callback = callback.as_ref().unwrap(); |
110 | |
111 | // let result = callback(state.clone(), *object); |
112 | |
113 | // match result { |
114 | // Ok(setting) => Ok(NewAnySetting::new(setting)), |
115 | // Err(_) => todo!(), |
116 | // } |
117 | todo! |
118 | |
119 | |
120 | |
121 | ; |
122 | |
123 | |
124 | type CallbackFunc = unsafe extern "C" fn |
125 | &PluginState, |
126 | object: , |
127 | setting_name: &str, |
128 | new_setting: Setting, |
129 | ; |
130 | |
131 | |
132 | |
133 | unsafe extern "C" |
134 | state: &PluginState, |
135 | object: , |
136 | setting_name: &str, |
137 | new_setting: Setting, |
138 | ; |
139 | |
140 | |
141 | |
142 | unsafe extern "C" |
143 | _state: &PluginState, |
144 | _object: , |
145 | _setting_name: &str, |
146 | _new_setting: Setting, |
147 | |
148 | todo! |
149 | |
150 | |
151 |