Structure refactoring
parent: tbd commit: a8f41ac
1 | use BoxFuture; |
2 | use FutureExt; |
3 | use ; |
4 | use |
5 | , | UnsafeCell
6 | , | Future
7 | , | PhantomData
8 | , | transmute
9 | , |
10 | ; |
11 | |
12 | |
13 | |
14 | callback: PluginState, |
15 | waker_func: unsafe extern "C" fn , |
16 | |
17 | |
18 | |
19 | waker: Waker, |
20 | |
21 | |
22 | unsafe extern "C" |
23 | |
24 | |
25 | inner: , |
26 | runtime_future: , |
27 | |
28 | |
29 | unsafe |
30 | unsafe |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | todo! |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | &self, |
43 | future: F, |
44 | ; |
45 | |
46 | |
47 | |
48 | |
49 | &self, |
50 | future: F, |
51 | |
52 | // let type_eraser = async move { |
53 | // let result = future.await; |
54 | |
55 | // FFIBox::from_box(Box::new(result)).untyped() |
56 | // }; |
57 | |
58 | // let runtime_future = unsafe { FfiFuture::from_raw(poll_local, type_eraser.boxed()) }; |
59 | |
60 | // RuntimeFuture(runtime_future) |
61 | |
62 | todo! |
63 | |
64 | |
65 | |
66 | unsafe extern "C" |
67 | _future: , |
68 | mut future_state: , |
69 | |
70 | let mut future_state: = transmute; |
71 | |
72 | let runtime_future = future_state.as_ref; |
73 | |
74 | let raw_waker = new |
75 | Box into_raw as *const , |
76 | &RUNTIME_FUTURE_WAKER_VTABLE, |
77 | ; |
78 | |
79 | let waker = unsafe ; |
80 | |
81 | // SAFETY: Pretty sure this has to be static lol |
82 | let poll_result = future_state.poll_unpin; |
83 | |
84 | match poll_result |
85 | => Ready, | Ready
86 | => Pending, | Pending
87 | |
88 | |
89 | |
90 | pub static RUNTIME_FUTURE_WAKER_VTABLE: RawWakerVTable = new |
91 | , | waker_clone
92 | , | waker_wake
93 | , | waker_wake_by_ref
94 | , | waker_drop
95 | ; |
96 | |
97 | |
98 | use RawWaker; |
99 | |
100 | pub unsafe |
101 | todo! |
102 | |
103 | |
104 | pub unsafe |
105 | todo! |
106 | |
107 | |
108 | pub unsafe |
109 | todo! |
110 | |
111 | |
112 | pub unsafe |
113 | // no-op |
114 | |
115 | |
116 | |
117 | |
118 | ; |
119 | |
120 | /// Allows for a remote future to be polled on the target. |
121 | /// |
122 | /// The target can be the host or a plugin, but the future should only be polled by one |
123 | /// source. |
124 | |
125 | type Output = Output; |
126 | |
127 | |
128 | mut self: , |
129 | cx: &mut , |
130 | |
131 | let waker_state = WakerState |
132 | waker: cx.waker .clone, |
133 | ; |
134 | |
135 | let waker_state = from; |
136 | |
137 | unsafe ; |
138 | |
139 | match unsafe |
140 | => | Ready
141 | let result: = unsafe ; |
142 | |
143 | Ready |
144 | |
145 | => Pending, | Pending
146 | |
147 | |
148 | |
149 | |
150 | unsafe extern "C" |
151 | todo! |
152 | |
153 |