More restructuring
parent: tbd commit: 10b7b7c
1 | use Future; |
2 | |
3 | use |
4 | , GiteratedObject, GiteratedOperation, | OperationError
5 | ; |
6 | |
7 | use crate:: |
8 | , | FfiResult
9 | , | State
10 | , | FfiValueUntyped
11 | , |
12 | FfiFuture, FfiValueMut, FfiValueRef, |
13 | ; |
14 | |
15 | use ; |
16 | |
17 | use Debug; |
18 | |
19 | ; |
20 | |
21 | |
22 | type CallbackFunc = unsafe extern "C" fn |
23 | , |
24 | state: , |
25 | object: , |
26 | operation: , |
27 | |
28 | , |
29 | >; |
30 | |
31 | |
32 | |
33 | unsafe extern "C" |
34 | callback_ptr: , |
35 | state: , |
36 | object: , |
37 | operation: , |
38 | ; |
39 | ; |
40 | |
41 | |
42 | |
43 | |
44 | Fut: + Send + Sync, |
45 | F: Fn(O, D) -> Fut + Send + Sync + 'static, |
46 | O: Debug + GiteratedObject + 'static, |
47 | D: Debug + + 'static, |
48 | |
49 | unsafe extern "C" |
50 | callback: , |
51 | state: , |
52 | object: , |
53 | operation: , |
54 | |
55 | todo! |
56 | // let _guard = trace_span!( |
57 | // "operation handler", |
58 | // object = type_name::<O>(), |
59 | // operation = type_name::<D>() |
60 | // ) |
61 | // .entered(); |
62 | // let state = unsafe { state.transmute_ref::<S>() }; |
63 | |
64 | // // Since this is Rust code, we know that the AnyObject and AnyOperation are just boxes |
65 | // let object = unsafe { object.transmute_owned::<O>() }; |
66 | // let operation = unsafe { operation.transmute_owned::<D>() }; |
67 | |
68 | // // Cast the callback ptr to ourselves |
69 | // let callback: *const F = std::mem::transmute(callback.0); |
70 | // let callback = callback.as_ref().unwrap(); |
71 | |
72 | // let state = state.clone(); |
73 | // runtime_state.spawn_future(async move { |
74 | // let result = callback(state, *object, *operation).await; |
75 | |
76 | // match result { |
77 | // Ok(success) => unsafe { |
78 | // todo!() |
79 | // // Ok(AnySuccess::from_raw( |
80 | // // FFIBox::from_box(Box::new(success)).untyped(), |
81 | // // OperationVTable::new::<O, D>(), |
82 | // // )) |
83 | // }, |
84 | // Err(err) => match err { |
85 | // OperationError::Operation(_) => todo!(), |
86 | // OperationError::Internal(_) => todo!(), |
87 | // OperationError::Unhandled => todo!(), |
88 | // }, |
89 | // } |
90 | // }) |
91 | |
92 | |
93 | |
94 | // unsafe { CallbackPtr::from_raw(self as *const _ as *const ()) } |
95 | |
96 | todo! |
97 | |
98 | |
99 | |
100 | |
101 | |
102 | Fut: , |
103 | F: Fn(O, D, A1) -> Fut, |
104 | O: Debug + GiteratedObject, |
105 | D: Debug + , |
106 | |
107 | unsafe extern "C" |
108 | _callback_ptr: , |
109 | state: , |
110 | object: , |
111 | operation: , |
112 | |
113 | todo! |
114 | |
115 | |
116 | |
117 | todo! |
118 | |
119 | |
120 | |
121 | |
122 | |
123 | Fut: , |
124 | F: Fn(O, D, A1, A2) -> Fut, |
125 | O: Debug + GiteratedObject, |
126 | D: Debug + , |
127 | |
128 | unsafe extern "C" |
129 | _callback_ptr: , |
130 | state: , |
131 | object: , |
132 | operation: , |
133 | |
134 | todo! |
135 | |
136 | |
137 | |
138 | todo! |
139 | |
140 | |
141 |