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