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